12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818 |
- (function webpackUniversalModuleDefinition(root, factory) {
- if(typeof exports === 'object' && typeof module === 'object')
- module.exports = factory();
- else if(typeof define === 'function' && define.amd)
- define([], factory);
- else if(typeof exports === 'object')
- exports["ivprogCore"] = factory();
- else
- root["ivprogCore"] = factory();
- })(self, function() {
- return /******/ (() => { // webpackBootstrap
- /******/ var __webpack_modules__ = ({
- /***/ "./i18n/error.csv":
- /*!************************!*\
- !*** ./i18n/error.csv ***!
- \************************/
- /***/ ((module) => {
- 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."}}
- /***/ }),
- /***/ "./i18n/message.csv":
- /*!**************************!*\
- !*** ./i18n/message.csv ***!
- \**************************/
- /***/ ((module) => {
- 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."}}
- /***/ }),
- /***/ "./i18n/ui.csv":
- /*!*********************!*\
- !*** ./i18n/ui.csv ***!
- \*********************/
- /***/ ((module) => {
- 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"}}
- /***/ }),
- /***/ "./js/assessment/ivprogAssessment.js":
- /*!*******************************************!*\
- !*** ./js/assessment/ivprogAssessment.js ***!
- \*******************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "IVProgAssessment": () => (/* binding */ IVProgAssessment)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var line_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
- /* harmony import */ var _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
- /* harmony import */ var _io_domConsole__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./../io/domConsole */ "./js/io/domConsole.js");
- /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../services/localizedStringsService */ "./js/services/localizedStringsService.js");
- /* harmony import */ var _output_matching_output_matching__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./output_matching/output_matching */ "./js/assessment/output_matching/output_matching.js");
- /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../util/config */ "./js/util/config.ts");
- var LocalizedStrings = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_5__.getInstance();
- var StringTypes = line_i18n__WEBPACK_IMPORTED_MODULE_2__["default"].StringTypes;
- var AssessmentConfig = {
- max_instruction_count: 350250,
- suspend_threshold: 200
- };
- var IVProgAssessment = /*#__PURE__*/function () {
- function IVProgAssessment(ast_code, testCases, domConsole) {
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, IVProgAssessment);
- this.ast_code = ast_code;
- this.testCases = testCases;
- this.domConsole = domConsole;
- this.old_config = JSON.parse(JSON.stringify(_util_config__WEBPACK_IMPORTED_MODULE_7__.Config));
- _util_config__WEBPACK_IMPORTED_MODULE_7__.Config.setConfig(AssessmentConfig);
- }
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(IVProgAssessment, [{
- key: "runTest",
- value: function runTest() {
- var _this = this;
- try {
- // loop test cases and show messages through domconsole
- var partialTests = this.testCases.map(function (t, name) {
- 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);
- });
- var testResult = partialTests.map(function (om) {
- return om.eval();
- });
- return Promise.all(testResult).then(function (results) {
- var grade = 0;
- for (var i = 0; i < results.length; i += 1) {
- var result = results[i];
- grade += result.grade;
- if (result.grade == 1) {
- _this.writeToConsole(_io_domConsole__WEBPACK_IMPORTED_MODULE_4__.DOMConsole.INFO, StringTypes.MESSAGE, 'test_case_success', result.name + 1, result.generateOutput());
- } else if (result.status == 1) {
- _this.writeToConsole(_io_domConsole__WEBPACK_IMPORTED_MODULE_4__.DOMConsole.ERR, StringTypes.ERROR, 'test_case_failed_exception', result.name + 1, result.error_msg, result.generateOutput());
- } else {
- _this.writeToConsole(_io_domConsole__WEBPACK_IMPORTED_MODULE_4__.DOMConsole.ERR, StringTypes.ERROR, 'test_case_failed', result.name + 1, result.generateOutput());
- }
- }
- grade /= results.length;
- var channel = grade == 1 ? _io_domConsole__WEBPACK_IMPORTED_MODULE_4__.DOMConsole.INFO : _io_domConsole__WEBPACK_IMPORTED_MODULE_4__.DOMConsole.ERR;
- _this.writeToConsole(channel, StringTypes.MESSAGE, "test_suite_grade", (grade * 100).toFixed(2));
- return grade;
- }); // return testResult.then(function (total) {
- // const grade = total / this.testCases.length;
- // const channel = grade == 1 ? DOMConsole.INFO : DOMConsole.ERR;
- // this.writeToConsole(channel, StringTypes.MESSAGE, "test_suite_grade", (grade * 100).toFixed(2));
- // return Promise.resolve(grade)
- // }).catch(err => {
- // this.domConsole.err("Erro inesperado durante o cálculo da nota.");// try and show error messages through domconsole
- // this.domConsole.err(err.message);
- // return Promise.resolve(0);
- // });
- } catch (error) {
- this.showErrorMessage(_io_domConsole__WEBPACK_IMPORTED_MODULE_4__.DOMConsole.ERR, StringTypes.MESSAGE, "unexpected_execution_error");
- this.domConsole.err(error.message);
- return Promise.resolve(0);
- } finally {
- _util_config__WEBPACK_IMPORTED_MODULE_7__.Config.setConfig(this.old_config);
- }
- }
- }, {
- key: "showErrorMessage",
- value: function showErrorMessage(errorID) {
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- args[_key - 1] = arguments[_key];
- }
- this.domConsole.err(LocalizedStrings.getError(errorID, args));
- }
- }, {
- key: "showInfoMessage",
- value: function showInfoMessage(msgID) {
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
- args[_key2 - 1] = arguments[_key2];
- }
- this.domConsole.info(LocalizedStrings.getMessage(msgID, args));
- }
- }, {
- key: "writeToConsole",
- value: function writeToConsole(channel, msgType, msgID) {
- var msg = LocalizedStrings.getString(msgID, msgType);
- for (var _len3 = arguments.length, args = new Array(_len3 > 3 ? _len3 - 3 : 0), _key3 = 3; _key3 < _len3; _key3++) {
- args[_key3 - 3] = arguments[_key3];
- }
- msg = LocalizedStrings.processString(msg, args);
- this.domConsole.writeRawHTML(msg, channel);
- }
- }]);
- return IVProgAssessment;
- }();
- /***/ }),
- /***/ "./js/assessment/output_matching/assessment_result.js":
- /*!************************************************************!*\
- !*** ./js/assessment/output_matching/assessment_result.js ***!
- \************************************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "OutputAssessmentResult": () => (/* binding */ OutputAssessmentResult)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _util_string_diff__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../util/string_diff */ "./js/util/string_diff.js");
- /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
- var OutputAssessmentResult = /*#__PURE__*/function () {
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(OutputAssessmentResult, null, [{
- key: "PAGE_TEMPLATE",
- get: function get() {
- 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>";
- }
- }, {
- key: "DETAIL_TEMPLATE",
- get: function get() {
- 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>";
- }
- }, {
- key: "OUPUT_TABLE_TEMPLATE",
- get: function get() {
- 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>";
- }
- }, {
- key: "OUTPUT_TEMPLATE",
- get: function get() {
- return "<tr><td class=':class-expected:'>$0</td>\n <td class=':class-generated:'>$1</td>\n <td class=':class-result:'>$2</td></tr>";
- }
- }, {
- key: "EMPTY_OUTPUT_TEMPLATE",
- get: function get() {
- return "<div class='assessment-popup'><img class='assessment-empty-output' src='img/empty.svg'>\n <span class='assessment-popuptext'>$0</span></div>";
- }
- }, {
- key: "FAILED_TEMPLATE",
- get: function get() {
- return "<p class='assessment-failed-execution'><span class='assessment-failed-case'>\u2717</span>$0</p>";
- }
- }, {
- key: "INPUT_INFO_TEMPLATE",
- get: function get() {
- return "<span class='$0'>$1</span>";
- } // Status code - it is not grade related!
- // 0 - Succesful execution
- // 1 - failed execution
- }]);
- function OutputAssessmentResult(name, status, inputs, result, store, time) {
- var error_msg = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : '';
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, OutputAssessmentResult);
- this.name = name;
- this.status = status;
- this.inputs = inputs;
- this.results = result;
- this.store = store;
- this.time = time;
- this.error_msg = error_msg;
- }
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(OutputAssessmentResult, [{
- key: "prepareResults",
- value: function prepareResults() {
- var _this = this;
- var template = OutputAssessmentResult.DETAIL_TEMPLATE;
- var grade = (this.grade * 100).toFixed(2);
- var time = this.time || "-";
- template = template.replace(':test-name:', _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI('assessment-detail-title', [this.name + 1]));
- template = template.replace(':time-label:', _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI('assessment-detail-time-label'));
- template = template.replace(':time:', time);
- template = template.replace(':grade-label:', _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI('assessment-detail-grade-label'));
- template = template.replace(':grade:', grade);
- var input_spans = this.prepareInputList(this.inputs);
- template = template.replace(':input-label:', _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI('assessment-detail-input-label'));
- template = template.replace(':input-list:', input_spans);
- template = template.replace(':output-label:', _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI('assessment-detail-output-label'));
- if (this.status == 0) {
- var output_rows = this.results.map(function (result) {
- if (result.type == "string") {
- return _this.formatString(result);
- } else if (result.type == "number") {
- return _this.formatNumber(result);
- } else {
- return _this.formatBool(result);
- }
- }, this);
- template = template.replace(':output-result:', this.prepareOutputTable(output_rows));
- } else {
- var failed_text = OutputAssessmentResult.FAILED_TEMPLATE;
- failed_text = failed_text.replace("$0", this.error_msg);
- template = template.replace(":output-result:", failed_text);
- }
- return template;
- }
- }, {
- key: "prepareInputList",
- value: function prepareInputList(input_list) {
- var list = input_list.map(function (input) {
- var template = OutputAssessmentResult.INPUT_INFO_TEMPLATE;
- template = template.replace("$1", input.value);
- if (input.read) {
- template = template.replace("$0", "assessment-input-read");
- } else {
- template = template.replace("$0", "assessment-input-unread");
- }
- return template;
- }, this);
- return list.join(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI('text_join_assessment_outputs'));
- }
- }, {
- key: "prepareOutputTable",
- value: function prepareOutputTable(output_rows) {
- var template = OutputAssessmentResult.OUPUT_TABLE_TEMPLATE;
- template = template.replace(':expected-label:', _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI('assessment-detail-expected-label'));
- template = template.replace(':generated-label:', _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI('assessment-detail-generated-label'));
- template = template.replace(':result-label:', _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI('assessment-detail-result-label'));
- template = template.replace(':results:', output_rows.join(''));
- return template;
- }
- }, {
- key: "generateOutput",
- value: function generateOutput() {
- var assessment_result = this.prepareResults();
- var page = OutputAssessmentResult.PAGE_TEMPLATE;
- page = page.replace(':assessment-result:', assessment_result);
- page = page.replace(/(\r|\n|\t)/gm, '').replace(/> *</g, '><');
- return page;
- }
- }, {
- key: "formatNumber",
- value: function formatNumber(result) {
- var result_class = result.grade == 1 ? 'assessment-number-result' : 'assessment-number-result-failed';
- var template = this.formatOutput('assessment-number-expected', 'assessment-number-generated', result_class, result);
- return template;
- }
- }, {
- key: "formatBool",
- value: function formatBool(result) {
- var result_class = result.grade == 1 ? 'assessment-bool-result' : 'assessment-bool-result-failed';
- var template = this.formatOutput('assessment-bool-expected', 'assessment-bool-generated', result_class, result);
- return template;
- }
- }, {
- key: "formatOutput",
- value: function formatOutput(expected_class, generated_class, result_class, result) {
- var template = OutputAssessmentResult.OUTPUT_TEMPLATE;
- template = template.replace(":class-expected:", expected_class);
- template = template.replace(":class-generated:", generated_class);
- template = template.replace(":class-result:", result_class);
- var expected_tmpl = result.expected;
- var generated_tmpl = result.generated;
- if (expected_tmpl == null) {
- expected_tmpl = OutputAssessmentResult.EMPTY_OUTPUT_TEMPLATE.replace('$0', _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getMessage('assessment-empty-expected-tooltip'));
- } else if (generated_tmpl == null) {
- generated_tmpl = OutputAssessmentResult.EMPTY_OUTPUT_TEMPLATE.replace('$0', _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getMessage('assessment-empty-generated-tooltip'));
- }
- template = template.replace("$0", expected_tmpl);
- template = template.replace("$1", generated_tmpl);
- var final_result = result.grade == 1 ? "✓" : "✗";
- template = template.replace("$2", final_result);
- return template;
- }
- }, {
- key: "formatString",
- value: function formatString(result) {
- var _this2 = this;
- var expected_class = 'assessment-string-expected';
- var generated_class = 'assessment-string-generated'; //const result_class = 'assessment-string-result';
- var template = OutputAssessmentResult.OUTPUT_TEMPLATE;
- template = template.replace(":class-expected:", expected_class);
- template = template.replace(":class-generated:", generated_class); //template = template.replace(":class-result:", result_class);
- var g_string = result.generated || "";
- var e_string = result.expected || ""; // console.log("generated: ", g_string,"expected: ", e_string);
- var g_string_tmpl = g_string;
- var e_string_tmpl = e_string;
- if (result.generated == null) {
- g_string_tmpl = OutputAssessmentResult.EMPTY_OUTPUT_TEMPLATE.replace('$0', _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getMessage('assessment-empty-generated-tooltip'));
- } else if (result.expected == null) {
- e_string_tmpl = OutputAssessmentResult.EMPTY_OUTPUT_TEMPLATE.replace('$0', _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getMessage('assessment-empty-expected-tooltip'));
- }
- template = template.replace("$0", e_string_tmpl);
- template = template.replace("$1", g_string_tmpl);
- if (result.grade == 1) {
- template = template.replace("$2", "✓");
- template = template.replace(":class-result:", 'assessment-string-result');
- } else {
- var diff = (0,_util_string_diff__WEBPACK_IMPORTED_MODULE_2__["default"])(g_string, e_string); // console.log(diff);
- var diff_vec = diff.map(function (part) {
- return _this2.getDiffStringStyle(part[1], part[0]);
- }, this);
- var diff_string = diff_vec.reduce(function (prev, actual) {
- return prev + actual;
- }, "");
- template = template.replace("$2", "<span class='assessment-failed-case'>✗</span>" + diff_string);
- template = template.replace(":class-result:", "assessment-string-diff");
- }
- return template;
- }
- }, {
- key: "getDiffStringStyle",
- value: function getDiffStringStyle(text, action) {
- var template = "<span class='$0'>$1</span>"; // Fix missing whitespace when its a single element
- text = text.replace(/\s/g, " ");
- switch (action) {
- case _util_string_diff__WEBPACK_IMPORTED_MODULE_2__["default"].INSERT:
- return template.replace("$0", "stringdiff-insert").replace("$1", text);
- case _util_string_diff__WEBPACK_IMPORTED_MODULE_2__["default"].DELETE:
- return template.replace("$0", "stringdiff-delete").replace("$1", text);
- case _util_string_diff__WEBPACK_IMPORTED_MODULE_2__["default"].EQUAL:
- return template.replace("$0", "stringdiff-equal").replace("$1", text);
- }
- }
- }, {
- key: "grade",
- get: function get() {
- if (this.results == null) {
- return 0;
- }
- return this.results.reduce(function (prev, val) {
- return prev + val.grade;
- }, 0) / this.results.length;
- }
- }]);
- return OutputAssessmentResult;
- }();
- /***/ }),
- /***/ "./js/assessment/output_matching/output_matching.js":
- /*!**********************************************************!*\
- !*** ./js/assessment/output_matching/output_matching.js ***!
- \**********************************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "OutputMatching": () => (/* binding */ OutputMatching)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
- /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(decimal_js__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _util_input_assessment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../util/input_assessment */ "./js/util/input_assessment.js");
- /* harmony import */ var _util_outputTest__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../util/outputTest */ "./js/util/outputTest.js");
- /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../util/config */ "./js/util/config.ts");
- /* harmony import */ var _util_utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../util/utils */ "./js/util/utils.js");
- /* harmony import */ var _assessment_result__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./assessment_result */ "./js/assessment/output_matching/assessment_result.js");
- /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
- /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
- /* harmony import */ var _output_result__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./output_result */ "./js/assessment/output_matching/output_result.js");
- var LocalizedStrings = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_9__.getInstance();
- var OutputMatching = /*#__PURE__*/function () {
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(OutputMatching, null, [{
- key: "NUM_REGEX",
- get: function get() {
- return /^[+-]?([0-9]+([.][0-9]*)?(e[+-]?[0-9]+)?)$/;
- }
- }, {
- key: "NUM_IN_STRING_REGEX",
- get: function get() {
- return /[+-]?([0-9]+([.][0-9]*)?(e[+-]?[0-9]+)?)/g;
- }
- }, {
- key: "BOOLEAN_REGEX",
- get: function get() {
- var str = "^(".concat(LocalizedStrings.getUI("logic_value_true"), "|").concat(LocalizedStrings.getUI("logic_value_false"), ")$");
- return new RegExp(str);
- }
- }, {
- key: "BOOLEAN_IN_STRING_REGEX",
- get: function get() {
- var str = "(".concat(LocalizedStrings.getUI("logic_value_true"), "|").concat(LocalizedStrings.getUI("logic_value_false"), ")");
- return new RegExp(str, 'g');
- }
- }]);
- function OutputMatching(program, input_list, expected_output, test_name) {
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, OutputMatching);
- this.program = program;
- this.name = test_name;
- this.input_list = input_list;
- this.expected_output = expected_output;
- }
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(OutputMatching, [{
- key: "eval",
- value: function _eval() {
- var _this = this;
- var refThis = this;
- var input = new _util_input_assessment__WEBPACK_IMPORTED_MODULE_3__.InputAssessment(this.input_list);
- var gen_output = new _util_outputTest__WEBPACK_IMPORTED_MODULE_4__.OutputTest();
- this.program.registerInput(input);
- this.program.registerOutput(gen_output);
- var start_time = Date.now();
- return this.program.interpretAST().then(function (sto) {
- var final_time = Date.now() - start_time;
- if (input.isInputAvailable()) {
- 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));
- }
- var result = gen_output.list.map(function (g_out, i) {
- if (i >= _this.expected_output.length) {
- return new _output_result__WEBPACK_IMPORTED_MODULE_10__.OutputMatchResult(null, g_out, 0, _this.getPotentialOutputType(g_out));
- }
- return _this.outputMatch(g_out, _this.expected_output[i]);
- }, _this);
- if (_this.expected_output.length > gen_output.list.length) {
- console.log("Saída insuficientes!", _this.expected_output.length, gen_output.list.length);
- for (var i = gen_output.list.length; i < _this.expected_output.length; ++i) {
- var e_out = _this.expected_output[i];
- result.push(new _output_result__WEBPACK_IMPORTED_MODULE_10__.OutputMatchResult(e_out, null, 0, _this.getPotentialOutputType(e_out)));
- }
- } else if (_this.expected_output.length == 0 && _this.expected_output.length == gen_output.list.length) {
- // no output expected....
- result.push(new _output_result__WEBPACK_IMPORTED_MODULE_10__.OutputMatchResult("", "", 1, "string"));
- }
- return new _assessment_result__WEBPACK_IMPORTED_MODULE_7__.OutputAssessmentResult(_this.name, 0, input.input_list, result, sto, final_time);
- })["catch"](function (error) {
- 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));
- });
- }
- }, {
- key: "getPotentialOutputType",
- value: function getPotentialOutputType(output) {
- if (OutputMatching.NUM_REGEX.test(output)) {
- return "number";
- } else if (OutputMatching.BOOLEAN_REGEX.test(output)) {
- return "bool";
- } else {
- return "string";
- }
- }
- }, {
- key: "outputMatch",
- value: function outputMatch(g_output, e_output) {
- if (OutputMatching.NUM_REGEX.test(e_output)) {
- if (!OutputMatching.NUM_REGEX.test(g_output)) {
- return this.checkStrings(g_output, e_output);
- }
- var g_num = new decimal_js__WEBPACK_IMPORTED_MODULE_2__.Decimal(g_output);
- var e_num = new decimal_js__WEBPACK_IMPORTED_MODULE_2__.Decimal(e_output);
- return this.checkNumbers(g_num, e_num);
- } else if (OutputMatching.BOOLEAN_REGEX.test(e_output)) {
- if (!OutputMatching.BOOLEAN_REGEX.test(g_output)) {
- return this.checkStrings(g_output, e_output);
- }
- var g_bool = _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_8__.toBool(g_output);
- var e_bool = _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_8__.toBool(e_output);
- return this.checkBoolean(g_bool, e_bool);
- } else {
- return this.checkStrings(g_output, e_output);
- }
- }
- }, {
- key: "checkNumbers",
- value: function checkNumbers(g_num, e_num) {
- var decimalPlaces = Math.min(e_num.dp(), _util_config__WEBPACK_IMPORTED_MODULE_5__.Config.decimalPlaces);
- g_num = new decimal_js__WEBPACK_IMPORTED_MODULE_2__.Decimal(g_num.toFixed(decimalPlaces, decimal_js__WEBPACK_IMPORTED_MODULE_2__.Decimal.ROUND_FLOOR));
- e_num = new decimal_js__WEBPACK_IMPORTED_MODULE_2__.Decimal(e_num.toFixed(decimalPlaces, decimal_js__WEBPACK_IMPORTED_MODULE_2__.Decimal.ROUND_FLOOR));
- var result = g_num.eq(e_num);
- var grade = result ? 1 : 0;
- return _output_result__WEBPACK_IMPORTED_MODULE_10__.createNumberResult(e_num.toNumber(), g_num.toNumber(), grade);
- }
- }, {
- key: "checkBoolean",
- value: function checkBoolean(g_bool, e_bool) {
- var grade = g_bool == e_bool ? 1 : 0;
- var g_bool_text = _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_8__.convertBoolToString(g_bool);
- var e_bool_text = _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_8__.convertBoolToString(e_bool);
- return _output_result__WEBPACK_IMPORTED_MODULE_10__.createBoolResult(e_bool_text, g_bool_text, grade);
- }
- }, {
- key: "checkStrings",
- value: function checkStrings(g_output, e_ouput) {
- var _this2 = this;
- var assessmentList = [];
- var e_output_clean = e_ouput.trim();
- var g_output_clean = g_output.trim();
- if (OutputMatching.NUM_IN_STRING_REGEX.test(e_ouput)) {
- var expected_numbers = e_ouput.match(OutputMatching.NUM_IN_STRING_REGEX);
- var generated_numbers = g_output.match(OutputMatching.NUM_IN_STRING_REGEX) || [];
- var result = generated_numbers.map(function (val, i) {
- if (i >= expected_numbers.length) {
- return _output_result__WEBPACK_IMPORTED_MODULE_10__.createNumberResult(null, val, 0);
- }
- var g_val = new decimal_js__WEBPACK_IMPORTED_MODULE_2__.Decimal(val);
- var e_val = new decimal_js__WEBPACK_IMPORTED_MODULE_2__.Decimal(expected_numbers[i]);
- return _this2.checkNumbers(g_val, e_val);
- }, this);
- if (expected_numbers.length > generated_numbers.length) {
- for (var i = generated_numbers.length; i < expected_numbers.length; ++i) {
- result.push(_output_result__WEBPACK_IMPORTED_MODULE_10__.createNumberResult(expected_numbers[i], null, 0));
- }
- }
- e_output_clean = e_output_clean.replace(OutputMatching.NUM_IN_STRING_REGEX, '');
- g_output_clean = g_output_clean.replace(OutputMatching.NUM_IN_STRING_REGEX, '');
- var numberGrade = result.reduce(function (prev, r) {
- return prev + r.grade;
- }, 0) / result.length;
- assessmentList.push(numberGrade);
- }
- if (OutputMatching.BOOLEAN_IN_STRING_REGEX.test(e_ouput)) {
- var expected_bools = e_ouput.match(OutputMatching.BOOLEAN_IN_STRING_REGEX);
- var generated_bools = g_output.match(OutputMatching.BOOLEAN_IN_STRING_REGEX) || [];
- var _result = generated_bools.map(function (val, i) {
- if (i >= expected_bools.length) {
- return _output_result__WEBPACK_IMPORTED_MODULE_10__.createBoolResult(null, val, 0);
- }
- var g_bool = _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_8__.toBool(val);
- var e_bool = _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_8__.toBool(expected_bools[i]);
- return _this2.checkBoolean(g_bool, e_bool);
- }, this);
- if (expected_bools.length > generated_bools.length) {
- for (var _i = generated_bools.length; _i < expected_bools.length; ++_i) {
- _result.push(_output_result__WEBPACK_IMPORTED_MODULE_10__.createBoolResult(expected_bools[_i], null, 0));
- }
- }
- e_output_clean = e_output_clean.replace(OutputMatching.BOOLEAN_IN_STRING_REGEX, '');
- g_output_clean = g_output_clean.replace(OutputMatching.BOOLEAN_IN_STRING_REGEX, '');
- var boolGrade = _result.reduce(function (prev, r) {
- return prev + r.grade;
- }, 0) / _result.length;
- assessmentList.push(boolGrade);
- }
- var dist = (0,_util_utils__WEBPACK_IMPORTED_MODULE_6__.levenshteinDistance)(g_output_clean, e_output_clean);
- var gradeDiff = Math.max(0, e_output_clean.length - dist) / e_output_clean.length;
- gradeDiff = Number.isNaN(gradeDiff) ? 0 : gradeDiff;
- var assessment_size = assessmentList.length + 1;
- var gradeAcc = assessmentList.reduce(function (prev, val) {
- return prev + val / assessment_size;
- }, 0);
- var finalGrade = 1 * (gradeDiff / assessment_size + gradeAcc);
- return _output_result__WEBPACK_IMPORTED_MODULE_10__.createStringResult(e_ouput, g_output, finalGrade);
- }
- }, {
- key: "getErrorMessage",
- value: function getErrorMessage(errorID) {
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- args[_key - 1] = arguments[_key];
- }
- return LocalizedStrings.getError(errorID, args);
- }
- }]);
- return OutputMatching;
- }();
- /***/ }),
- /***/ "./js/assessment/output_matching/output_result.js":
- /*!********************************************************!*\
- !*** ./js/assessment/output_matching/output_result.js ***!
- \********************************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "createNumberResult": () => (/* binding */ createNumberResult),
- /* harmony export */ "createBoolResult": () => (/* binding */ createBoolResult),
- /* harmony export */ "createStringResult": () => (/* binding */ createStringResult),
- /* harmony export */ "OutputMatchResult": () => (/* binding */ OutputMatchResult)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- function createNumberResult(expected, generated, grade) {
- return new OutputMatchResult(expected, generated, grade, "number");
- }
- function createBoolResult(expected, generated, grade) {
- return new OutputMatchResult(expected, generated, grade, "bool");
- }
- function createStringResult(expected, generated, grade) {
- return new OutputMatchResult(expected, generated, grade, "string");
- }
- var OutputMatchResult = function OutputMatchResult(expected, generated, grade, type) {
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, OutputMatchResult);
- this.expected = expected;
- this.generated = generated;
- this.grade = grade;
- this.type = type;
- };
- /***/ }),
- /***/ "./js/ast/commands/arrayAssign.js":
- /*!****************************************!*\
- !*** ./js/ast/commands/arrayAssign.js ***!
- \****************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "ArrayIndexAssign": () => (/* binding */ ArrayIndexAssign)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__);
- /* harmony import */ var _assign__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./assign */ "./js/ast/commands/assign.js");
- 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); }; }
- 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; } }
- var ArrayIndexAssign = /*#__PURE__*/function (_Assign) {
- _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default()(ArrayIndexAssign, _Assign);
- var _super = _createSuper(ArrayIndexAssign);
- function ArrayIndexAssign(id, lineExpression, columnExpression, expression) {
- var _this;
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, ArrayIndexAssign);
- _this = _super.call(this, id, expression);
- _this.line = lineExpression;
- _this.column = columnExpression;
- return _this;
- }
- return ArrayIndexAssign;
- }(_assign__WEBPACK_IMPORTED_MODULE_4__.Assign);
- /***/ }),
- /***/ "./js/ast/commands/arrayDeclaration.js":
- /*!*********************************************!*\
- !*** ./js/ast/commands/arrayDeclaration.js ***!
- \*********************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "ArrayDeclaration": () => (/* binding */ ArrayDeclaration)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
- /* harmony import */ var _declaration__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./declaration */ "./js/ast/commands/declaration.js");
- 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); }; }
- 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; } }
- var ArrayDeclaration = /*#__PURE__*/function (_Declaration) {
- _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(ArrayDeclaration, _Declaration);
- var _super = _createSuper(ArrayDeclaration);
- function ArrayDeclaration(id, type, lines, columns, initial, isConst) {
- var _this;
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, ArrayDeclaration);
- _this = _super.call(this, id, type, initial, isConst);
- _this.lines = lines;
- _this.columns = columns;
- return _this;
- }
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(ArrayDeclaration, [{
- key: "isVector",
- get: function get() {
- return this.columns == null;
- }
- }]);
- return ArrayDeclaration;
- }(_declaration__WEBPACK_IMPORTED_MODULE_5__.Declaration);
- /***/ }),
- /***/ "./js/ast/commands/assign.js":
- /*!***********************************!*\
- !*** ./js/ast/commands/assign.js ***!
- \***********************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "Assign": () => (/* binding */ Assign)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__);
- /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
- 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); }; }
- 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; } }
- var Assign = /*#__PURE__*/function (_Command) {
- _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default()(Assign, _Command);
- var _super = _createSuper(Assign);
- function Assign(id, expression) {
- var _this;
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, Assign);
- _this = _super.call(this);
- _this.id = id;
- _this.expression = expression;
- return _this;
- }
- return Assign;
- }(_command__WEBPACK_IMPORTED_MODULE_4__.Command);
- /***/ }),
- /***/ "./js/ast/commands/break.js":
- /*!**********************************!*\
- !*** ./js/ast/commands/break.js ***!
- \**********************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "Break": () => (/* binding */ Break)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__);
- /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
- 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); }; }
- 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; } }
- var Break = /*#__PURE__*/function (_Command) {
- _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default()(Break, _Command);
- var _super = _createSuper(Break);
- function Break() {
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, Break);
- return _super.call(this);
- }
- return Break;
- }(_command__WEBPACK_IMPORTED_MODULE_4__.Command);
- /***/ }),
- /***/ "./js/ast/commands/case.js":
- /*!*********************************!*\
- !*** ./js/ast/commands/case.js ***!
- \*********************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "Case": () => (/* binding */ Case)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
- /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
- 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); }; }
- 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; } }
- var Case = /*#__PURE__*/function (_Command) {
- _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(Case, _Command);
- var _super = _createSuper(Case);
- function Case(expression) {
- var _this;
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, Case);
- _this = _super.call(this);
- _this.expression = expression;
- /**
- * @type {Command[]}
- */
- _this.commands = [];
- return _this;
- }
- /**
- *
- * @param {Command[]} commands
- */
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(Case, [{
- key: "setCommands",
- value: function setCommands(commands) {
- this.commands = commands;
- }
- }, {
- key: "isDefault",
- get: function get() {
- return this.expression === null;
- }
- }]);
- return Case;
- }(_command__WEBPACK_IMPORTED_MODULE_5__.Command);
- /***/ }),
- /***/ "./js/ast/commands/command.js":
- /*!************************************!*\
- !*** ./js/ast/commands/command.js ***!
- \************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "Command": () => (/* binding */ Command)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
- var Command = /*#__PURE__*/function () {
- function Command() {
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, Command);
- this._sourceInfo = null;
- }
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(Command, [{
- key: "sourceInfo",
- set: function set(sourceInfo) {
- this._sourceInfo = sourceInfo;
- },
- get: function get() {
- return this._sourceInfo;
- }
- }]);
- return Command;
- }();
- /***/ }),
- /***/ "./js/ast/commands/commandBlock.js":
- /*!*****************************************!*\
- !*** ./js/ast/commands/commandBlock.js ***!
- \*****************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "CommandBlock": () => (/* binding */ CommandBlock)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
- var CommandBlock = /*#__PURE__*/function () {
- function CommandBlock(variables, commands) {
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, CommandBlock);
- this.variables = variables;
- this.commands = commands;
- this._sourceInfo = null;
- }
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(CommandBlock, [{
- key: "sourceInfo",
- set: function set(sourceInfo) {
- this._sourceInfo = sourceInfo;
- },
- get: function get() {
- return this._sourceInfo;
- }
- }]);
- return CommandBlock;
- }();
- /***/ }),
- /***/ "./js/ast/commands/declaration.js":
- /*!****************************************!*\
- !*** ./js/ast/commands/declaration.js ***!
- \****************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "Declaration": () => (/* binding */ Declaration)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__);
- /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
- 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); }; }
- 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; } }
- var Declaration = /*#__PURE__*/function (_Command) {
- _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default()(Declaration, _Command);
- var _super = _createSuper(Declaration);
- function Declaration(id, type, initial, isConst) {
- var _this;
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, Declaration);
- _this = _super.call(this);
- _this.id = id;
- _this.type = type;
- _this.initial = initial;
- _this.isConst = isConst;
- return _this;
- }
- return Declaration;
- }(_command__WEBPACK_IMPORTED_MODULE_4__.Command);
- /***/ }),
- /***/ "./js/ast/commands/for.js":
- /*!********************************!*\
- !*** ./js/ast/commands/for.js ***!
- \********************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "For": () => (/* binding */ For)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
- /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
- 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); }; }
- 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; } }
- var For = /*#__PURE__*/function (_Command) {
- _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(For, _Command);
- var _super = _createSuper(For);
- function For(for_id, for_from, for_to, for_pass, commandBlock) {
- var _this;
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, For);
- _this = _super.call(this);
- _this.for_id = for_id;
- _this.for_from = for_from;
- _this.for_to = for_to;
- _this.for_pass = for_pass;
- _this.commandBlock = commandBlock;
- return _this;
- }
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(For, [{
- key: "commands",
- get: function get() {
- return this.commandBlock.commands;
- }
- }]);
- return For;
- }(_command__WEBPACK_IMPORTED_MODULE_5__.Command);
- /***/ }),
- /***/ "./js/ast/commands/formalParameter.js":
- /*!********************************************!*\
- !*** ./js/ast/commands/formalParameter.js ***!
- \********************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "FormalParameter": () => (/* binding */ FormalParameter)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
- var FormalParameter = /*#__PURE__*/function () {
- function FormalParameter(type, id) {
- var byRef = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
- var variadic = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, FormalParameter);
- this.type = type;
- this.id = id;
- this.byRef = byRef;
- this.variadic = variadic;
- this._sourceInfo = null;
- }
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(FormalParameter, [{
- key: "sourceInfo",
- set: function set(sourceInfo) {
- this._sourceInfo = sourceInfo;
- },
- get: function get() {
- return this._sourceInfo;
- }
- }]);
- return FormalParameter;
- }();
- /***/ }),
- /***/ "./js/ast/commands/function.js":
- /*!*************************************!*\
- !*** ./js/ast/commands/function.js ***!
- \*************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "Function": () => (/* binding */ Function)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.ts");
- var Function = /*#__PURE__*/function () {
- /**
- *
- * @param {string} name
- * @param {import('./../../typeSystem/itype').IType} returnType
- * @param {import('./formalParameter').FormalParameter[]} formalParameters
- * @param {import('./commandBlock').CommandBlock} commandBlock
- */
- function Function(name, returnType, formalParameters, commandBlock) {
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, Function);
- this.name = name;
- this.returnType = returnType;
- this.formalParameters = formalParameters;
- this.commandBlock = commandBlock;
- this._sourceInfo = null;
- }
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(Function, [{
- key: "hasVariadic",
- value: function hasVariadic() {
- return this.formalParameters.some(function (p) {
- return p.variadic;
- });
- }
- }, {
- key: "isMain",
- get: function get() {
- return this.name === null && this.returnType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__.Types.VOID);
- }
- }, {
- key: "commands",
- get: function get() {
- return this.commandBlock.commands;
- }
- }, {
- key: "variablesDeclarations",
- get: function get() {
- return this.commandBlock.variables;
- }
- }, {
- key: "sourceInfo",
- set: function set(sourceInfo) {
- this._sourceInfo = sourceInfo;
- },
- get: function get() {
- return this._sourceInfo;
- }
- }]);
- return Function;
- }();
- /***/ }),
- /***/ "./js/ast/commands/ifThenElse.js":
- /*!***************************************!*\
- !*** ./js/ast/commands/ifThenElse.js ***!
- \***************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "IfThenElse": () => (/* binding */ IfThenElse)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__);
- /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
- 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); }; }
- 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; } }
- var IfThenElse = /*#__PURE__*/function (_Command) {
- _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default()(IfThenElse, _Command);
- var _super = _createSuper(IfThenElse);
- function IfThenElse(condition, ifTrue, ifFalse) {
- var _this;
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, IfThenElse);
- _this = _super.call(this);
- _this.condition = condition;
- _this.ifTrue = ifTrue;
- _this.ifFalse = ifFalse;
- return _this;
- }
- return IfThenElse;
- }(_command__WEBPACK_IMPORTED_MODULE_4__.Command);
- /***/ }),
- /***/ "./js/ast/commands/index.js":
- /*!**********************************!*\
- !*** ./js/ast/commands/index.js ***!
- \**********************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "Break": () => (/* reexport safe */ _break__WEBPACK_IMPORTED_MODULE_0__.Break),
- /* harmony export */ "Return": () => (/* reexport safe */ _return__WEBPACK_IMPORTED_MODULE_1__.Return),
- /* harmony export */ "Assign": () => (/* reexport safe */ _assign__WEBPACK_IMPORTED_MODULE_2__.Assign),
- /* harmony export */ "ArrayIndexAssign": () => (/* reexport safe */ _arrayAssign__WEBPACK_IMPORTED_MODULE_3__.ArrayIndexAssign),
- /* harmony export */ "Declaration": () => (/* reexport safe */ _declaration__WEBPACK_IMPORTED_MODULE_4__.Declaration),
- /* harmony export */ "ArrayDeclaration": () => (/* reexport safe */ _arrayDeclaration__WEBPACK_IMPORTED_MODULE_5__.ArrayDeclaration),
- /* harmony export */ "While": () => (/* reexport safe */ _while__WEBPACK_IMPORTED_MODULE_6__.While),
- /* harmony export */ "For": () => (/* reexport safe */ _for__WEBPACK_IMPORTED_MODULE_7__.For),
- /* harmony export */ "Function": () => (/* reexport safe */ _function__WEBPACK_IMPORTED_MODULE_8__.Function),
- /* harmony export */ "IfThenElse": () => (/* reexport safe */ _ifThenElse__WEBPACK_IMPORTED_MODULE_9__.IfThenElse),
- /* harmony export */ "CommandBlock": () => (/* reexport safe */ _commandBlock__WEBPACK_IMPORTED_MODULE_10__.CommandBlock),
- /* harmony export */ "RepeatUntil": () => (/* reexport safe */ _repeatUntil__WEBPACK_IMPORTED_MODULE_11__.RepeatUntil),
- /* harmony export */ "Switch": () => (/* reexport safe */ _switch__WEBPACK_IMPORTED_MODULE_12__.Switch),
- /* harmony export */ "Case": () => (/* reexport safe */ _case__WEBPACK_IMPORTED_MODULE_13__.Case),
- /* harmony export */ "SysCall": () => (/* reexport safe */ _sysCall__WEBPACK_IMPORTED_MODULE_14__.SysCall),
- /* harmony export */ "FormalParameter": () => (/* reexport safe */ _formalParameter__WEBPACK_IMPORTED_MODULE_15__.FormalParameter),
- /* harmony export */ "FunctionCall": () => (/* reexport safe */ _expressions_functionCall__WEBPACK_IMPORTED_MODULE_16__.FunctionCall)
- /* harmony export */ });
- /* harmony import */ var _break__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./break */ "./js/ast/commands/break.js");
- /* harmony import */ var _return__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./return */ "./js/ast/commands/return.js");
- /* harmony import */ var _assign__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./assign */ "./js/ast/commands/assign.js");
- /* harmony import */ var _arrayAssign__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./arrayAssign */ "./js/ast/commands/arrayAssign.js");
- /* harmony import */ var _declaration__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./declaration */ "./js/ast/commands/declaration.js");
- /* harmony import */ var _arrayDeclaration__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./arrayDeclaration */ "./js/ast/commands/arrayDeclaration.js");
- /* harmony import */ var _while__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./while */ "./js/ast/commands/while.js");
- /* harmony import */ var _for__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./for */ "./js/ast/commands/for.js");
- /* harmony import */ var _function__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./function */ "./js/ast/commands/function.js");
- /* harmony import */ var _ifThenElse__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./ifThenElse */ "./js/ast/commands/ifThenElse.js");
- /* harmony import */ var _commandBlock__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./commandBlock */ "./js/ast/commands/commandBlock.js");
- /* harmony import */ var _repeatUntil__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./repeatUntil */ "./js/ast/commands/repeatUntil.js");
- /* harmony import */ var _switch__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./switch */ "./js/ast/commands/switch.js");
- /* harmony import */ var _case__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./case */ "./js/ast/commands/case.js");
- /* harmony import */ var _sysCall__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./sysCall */ "./js/ast/commands/sysCall.js");
- /* harmony import */ var _formalParameter__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./formalParameter */ "./js/ast/commands/formalParameter.js");
- /* harmony import */ var _expressions_functionCall__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./../expressions/functionCall */ "./js/ast/expressions/functionCall.js");
- //Proxy to expression since they do exatcly the same thing
- /***/ }),
- /***/ "./js/ast/commands/repeatUntil.js":
- /*!****************************************!*\
- !*** ./js/ast/commands/repeatUntil.js ***!
- \****************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "RepeatUntil": () => (/* binding */ RepeatUntil)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
- /* harmony import */ var _while__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./while */ "./js/ast/commands/while.js");
- 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); }; }
- 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; } }
- var RepeatUntil = /*#__PURE__*/function (_While) {
- _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(RepeatUntil, _While);
- var _super = _createSuper(RepeatUntil);
- function RepeatUntil(condition, commandBlock) {
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, RepeatUntil);
- return _super.call(this, condition, commandBlock);
- }
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(RepeatUntil, [{
- key: "testFirst",
- get: function get() {
- return false;
- }
- }]);
- return RepeatUntil;
- }(_while__WEBPACK_IMPORTED_MODULE_5__.While);
- /***/ }),
- /***/ "./js/ast/commands/return.js":
- /*!***********************************!*\
- !*** ./js/ast/commands/return.js ***!
- \***********************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "Return": () => (/* binding */ Return)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__);
- /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
- 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); }; }
- 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; } }
- var Return = /*#__PURE__*/function (_Command) {
- _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default()(Return, _Command);
- var _super = _createSuper(Return);
- function Return(expression) {
- var _this;
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, Return);
- _this = _super.call(this);
- _this.expression = expression;
- return _this;
- }
- return Return;
- }(_command__WEBPACK_IMPORTED_MODULE_4__.Command);
- /***/ }),
- /***/ "./js/ast/commands/switch.js":
- /*!***********************************!*\
- !*** ./js/ast/commands/switch.js ***!
- \***********************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "Switch": () => (/* binding */ Switch)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__);
- /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
- /* harmony import */ var _expressions_expression__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../expressions/expression */ "./js/ast/expressions/expression.js");
- /* harmony import */ var ___WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! . */ "./js/ast/commands/index.js");
- 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); }; }
- 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; } }
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
- var Switch = /*#__PURE__*/function (_Command) {
- _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default()(Switch, _Command);
- var _super = _createSuper(Switch);
- /**
- *
- * @param {Expression} expression
- * @param {Case[]} cases
- */
- function Switch(expression, cases) {
- var _this;
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, Switch);
- _this = _super.call(this);
- _this.expression = expression;
- _this.cases = cases;
- return _this;
- }
- return Switch;
- }(_command__WEBPACK_IMPORTED_MODULE_4__.Command);
- /***/ }),
- /***/ "./js/ast/commands/sysCall.js":
- /*!************************************!*\
- !*** ./js/ast/commands/sysCall.js ***!
- \************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "SysCall": () => (/* binding */ SysCall)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /**
- * This class represents all the language defined functions.
- * The language processor uses the id provided here to properly execute the desired function.
- * The function is actually implemented inside the language processor.
- * All the functions can be found at: js/processor/definedFunctions.js
- */
- var SysCall = function SysCall(langFunc) {
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, SysCall);
- this.langFunc = langFunc;
- };
- /***/ }),
- /***/ "./js/ast/commands/while.js":
- /*!**********************************!*\
- !*** ./js/ast/commands/while.js ***!
- \**********************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "While": () => (/* binding */ While)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
- /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
- 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); }; }
- 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; } }
- var While = /*#__PURE__*/function (_Command) {
- _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(While, _Command);
- var _super = _createSuper(While);
- function While(expression, commandBlock) {
- var _this;
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, While);
- _this = _super.call(this);
- _this.expression = expression;
- _this.commandBlock = commandBlock;
- return _this;
- }
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(While, [{
- key: "commands",
- get: function get() {
- return this.commandBlock.commands;
- }
- }, {
- key: "testFirst",
- get: function get() {
- return true;
- }
- }]);
- return While;
- }(_command__WEBPACK_IMPORTED_MODULE_5__.Command);
- /***/ }),
- /***/ "./js/ast/error/syntaxError.js":
- /*!*************************************!*\
- !*** ./js/ast/error/syntaxError.js ***!
- \*************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "SyntaxError": () => (/* binding */ SyntaxError)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/assertThisInitialized */ "./node_modules/@babel/runtime/helpers/assertThisInitialized.js");
- /* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3__);
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__);
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__);
- /* harmony import */ var _babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/wrapNativeSuper */ "./node_modules/@babel/runtime/helpers/wrapNativeSuper.js");
- /* harmony import */ var _babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_6__);
- 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); }; }
- 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; } }
- var SyntaxError = /*#__PURE__*/function (_Error) {
- _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3___default()(SyntaxError, _Error);
- var _super = _createSuper(SyntaxError);
- function SyntaxError(msg, id) {
- var _this;
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, SyntaxError);
- _this = _super.call(this, msg);
- _this.id = id;
- _this._context = {};
- if (Error.captureStackTrace) Error.captureStackTrace(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2___default()(_this), SyntaxError);
- return _this;
- }
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(SyntaxError, [{
- key: "context",
- get: function get() {
- return this._context;
- },
- set: function set(contextObj) {
- this._context = contextObj;
- }
- }]);
- return SyntaxError;
- }( /*#__PURE__*/_babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_6___default()(Error));
- /***/ }),
- /***/ "./js/ast/error/syntaxErrorFactory.js":
- /*!********************************************!*\
- !*** ./js/ast/error/syntaxErrorFactory.js ***!
- \********************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "SyntaxErrorFactory": () => (/* binding */ SyntaxErrorFactory)
- /* harmony export */ });
- /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
- /* harmony import */ var _syntaxError__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./syntaxError */ "./js/ast/error/syntaxError.js");
- var LocalizedStrings = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.getInstance();
- function createError(message_id) {
- var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
- return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__.SyntaxError(LocalizedStrings.getError(message_id, context), message_id);
- }
- var SyntaxErrorFactory = Object.freeze({
- extra_lines: function extra_lines() {
- return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__.SyntaxError(LocalizedStrings.getError("extra_lines"));
- },
- token_missing_one: function token_missing_one(expected, token) {
- var context = [expected, token.text, token.line, token.col];
- var error = createError("token_missing_one", context);
- error.context = {
- line: token.line,
- column: token.col
- };
- return error;
- },
- token_missing_list: function token_missing_list(expectedList, token) {
- var line = expectedList.join(LocalizedStrings.getOR());
- var error = SyntaxErrorFactory.token_missing_one(line, token);
- error.context = {
- line: token.line,
- column: token.col
- };
- return error;
- },
- id_missing: function id_missing(token) {
- var context = [token.text, token.line, token.col];
- var error = createError("id_missing", context);
- error.context = {
- line: token.line,
- column: token.col
- };
- return error;
- },
- eos_missing: function eos_missing(token) {
- var context = [token.line, token.col];
- var error = createError("eos_missing", context);
- error.context = {
- line: token.line,
- column: token.col
- };
- return error;
- },
- invalid_array_dimension: function invalid_array_dimension(typeName, token) {
- var context = [token.line, token.col, typeName];
- var error = createError("invalid_array_dimension", context);
- error.context = {
- line: token.line,
- column: token.col
- };
- return error;
- },
- invalid_array_size: function invalid_array_size(token) {
- var context = [token.line];
- var error = createError("invalid_array_size", context);
- error.context = {
- line: token.line,
- column: token.col
- };
- return error;
- },
- invalid_main_return: function invalid_main_return(name, typeName, token) {
- var context = [name, typeName, token.line];
- var error = createError("invalid_main_return", context);
- error.context = {
- line: token.line,
- column: token.col
- };
- return error;
- },
- invalid_var_declaration: function invalid_var_declaration(token) {
- var context = [token.line];
- var error = createError("invalid_var_declaration", context);
- error.context = {
- line: token.line,
- column: token.col
- };
- return error;
- },
- invalid_break_command: function invalid_break_command(cmdName, token) {
- var context = [token.line, cmdName];
- var error = createError("invalid_break_command", context);
- error.context = {
- line: token.line,
- column: token.col
- };
- return error;
- },
- invalid_terminal: function invalid_terminal(token) {
- var context = [token.text, token.line, token.col];
- var error = createError("invalid_terminal", context);
- error.context = {
- line: token.line,
- column: token.col
- };
- return error;
- },
- invalid_type: function invalid_type(list, token) {
- var line = list.join(LocalizedStrings.getOR());
- var context = [token.text, token.line, token.col, line];
- var error = createError("invalid_type", context);
- error.context = {
- line: token.line,
- column: token.col
- };
- return error;
- },
- const_not_init: function const_not_init(token) {
- var context = [token.line, token.col];
- var error = createError("const_not_init", context);
- error.context = {
- line: token.line,
- column: token.col
- };
- return error;
- },
- invalid_id_format: function invalid_id_format(token) {
- var context = [token.text, token.line, token.col];
- var error = createError("invalid_id_format", context);
- error.context = {
- line: token.line,
- column: token.col
- };
- return error;
- },
- duplicate_function: function duplicate_function(token) {
- var context = [token.text, token.line, token.col];
- var error = createError("duplicate_function", context);
- error.context = {
- line: token.line,
- column: token.col
- };
- return error;
- },
- main_parameters: function main_parameters() {
- return createError("main_parameters");
- },
- duplicate_variable: function duplicate_variable(token) {
- var context = [token.text, token.line, token.col];
- var error = createError("duplicate_variable", context);
- error.context = {
- line: token.line,
- column: token.col
- };
- return error;
- },
- invalid_character: function invalid_character(text, line, column) {
- var context = [text, line];
- var error = createError("invalid_character", context);
- error.context = {
- line: line,
- column: column
- };
- return error;
- },
- annonymous_array_literal: function annonymous_array_literal(token) {
- var context = [token.line];
- var error = createError("annonymous_array_literal", context);
- error.context = {
- line: token.line,
- column: token.col
- };
- return error;
- },
- invalid_matrix_literal_line: function invalid_matrix_literal_line(exp, sourceInfo) {
- var context = [exp, sourceInfo.line];
- var error = createError("invalid_matrix_literal_line", context);
- error.context = {
- line: sourceInfo.line,
- column: sourceInfo.column
- };
- return error;
- },
- cannot_infer_matrix_line: function cannot_infer_matrix_line(name, sourceInfo) {
- var context = [name, sourceInfo.line];
- var error = createError("cannot_infer_matrix_line", context);
- error.context = {
- line: sourceInfo.line,
- column: sourceInfo.column
- };
- return error;
- },
- cannot_infer_matrix_column: function cannot_infer_matrix_column(name, sourceInfo) {
- var context = [name, sourceInfo.line];
- var error = createError("cannot_infer_matrix_column", context);
- error.context = {
- line: sourceInfo.line,
- column: sourceInfo.column
- };
- return error;
- },
- cannot_infer_vector_size: function cannot_infer_vector_size(name, sourceInfo) {
- var context = [name, sourceInfo.line];
- var error = createError("cannot_infer_vector_size", context);
- error.context = {
- line: sourceInfo.line,
- column: sourceInfo.column
- };
- return error;
- },
- matrix_to_vector_literal_attr: function matrix_to_vector_literal_attr(name, exp, sourceInfo) {
- var context = [sourceInfo.line, exp, name];
- var error = createError("matrix_to_vector_literal_attr", context);
- error.context = {
- line: sourceInfo.line,
- column: sourceInfo.column
- };
- return error;
- },
- vector_to_matrix_literal_attr: function vector_to_matrix_literal_attr(name, exp, sourceInfo) {
- var context = [sourceInfo.line, exp, name];
- var error = createError("vector_to_matrix_literal_attr", context);
- error.context = {
- line: sourceInfo.line,
- column: sourceInfo.column
- };
- return error;
- },
- array_init_not_literal: function array_init_not_literal(sourceInfo) {
- var context = [sourceInfo.line];
- var error = createError("array_init_not_literal", context);
- error.context = {
- line: sourceInfo.line,
- column: sourceInfo.column
- };
- return error;
- },
- array_exceeds_2d: function array_exceeds_2d(sourceInfo) {
- var context = [sourceInfo.line];
- var error = createError("array_exceeds_2d", context);
- error.context = {
- line: sourceInfo.line,
- column: sourceInfo.column
- };
- return error;
- },
- invalid_matrix_id_dimension: function invalid_matrix_id_dimension(sourceInfo) {
- var context = [sourceInfo.line];
- var error = createError("invalid_matrix_id_dimension", context);
- error.context = {
- line: sourceInfo.line,
- column: sourceInfo.column
- };
- return error;
- },
- invalid_vector_init: function invalid_vector_init(sourceInfo) {
- var context = [sourceInfo.line];
- var error = createError("invalid_vector_init", context);
- error.context = {
- line: sourceInfo.line,
- column: sourceInfo.column
- };
- return error;
- },
- invalid_matrix_init: function invalid_matrix_init(sourceInfo) {
- var context = [sourceInfo.line];
- var error = createError("invalid_matrix_init", context);
- error.context = {
- line: sourceInfo.line,
- column: sourceInfo.column
- };
- return error;
- },
- invalid_syntax: function invalid_syntax(text, line, column) {
- var context = [text, line];
- var error = createError("invalid_syntax", context);
- error.context = {
- line: line,
- column: column
- };
- return error;
- }
- });
- /***/ }),
- /***/ "./js/ast/expressions/arrayAccess.js":
- /*!*******************************************!*\
- !*** ./js/ast/expressions/arrayAccess.js ***!
- \*******************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "ArrayAccess": () => (/* binding */ ArrayAccess)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
- /* harmony import */ var _expression__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
- 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); }; }
- 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; } }
- var ArrayAccess = /*#__PURE__*/function (_Expression) {
- _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(ArrayAccess, _Expression);
- var _super = _createSuper(ArrayAccess);
- function ArrayAccess(id, line, column) {
- var _this;
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, ArrayAccess);
- _this = _super.call(this);
- _this.id = id;
- _this.line = line;
- _this.column = column;
- return _this;
- }
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(ArrayAccess, [{
- key: "toString",
- value: function toString() {
- var strLine = this.line.toString();
- var strColumn = null;
- if (this.column) {
- strColumn = this.column.toString();
- }
- var text = null;
- if (strColumn) {
- text = "".concat(this.id, "[").concat(strLine, "][").concat(strColumn, "]");
- } else {
- text = "".concat(this.id, "[").concat(strLine, "]");
- }
- if (this.parenthesis) {
- return "(".concat(text, ")");
- } else {
- return text;
- }
- }
- }]);
- return ArrayAccess;
- }(_expression__WEBPACK_IMPORTED_MODULE_5__.Expression);
- /***/ }),
- /***/ "./js/ast/expressions/arrayLiteral.js":
- /*!********************************************!*\
- !*** ./js/ast/expressions/arrayLiteral.js ***!
- \********************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "ArrayLiteral": () => (/* binding */ ArrayLiteral)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
- /* harmony import */ var _literal__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
- 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); }; }
- 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; } }
- var ArrayLiteral = /*#__PURE__*/function (_Literal) {
- _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(ArrayLiteral, _Literal);
- var _super = _createSuper(ArrayLiteral);
- /**
- *
- * @param {import('../../typeSystem/itype').IType} type
- * @param {import('./expression').Expression[]} value
- */
- function ArrayLiteral(type, value) {
- var _this;
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, ArrayLiteral);
- _this = _super.call(this, type);
- _this.value = value;
- return _this;
- }
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(ArrayLiteral, [{
- key: "validateType",
- value: function validateType() {
- var valid = true; // const subtype = this.subtype;
- // if(this.columns !== null) {
- // const len = this.lines;
- // const len2 = this.columns;
- // for (let i = len - 1; i >= 0 && valid; --i) {
- // for (let j = len2 - 1; j >= 0 && valid; --j) {
- // if(!this.value[i].value[j].type.isCompatilbe(subtype)) {
- // valid = false;
- // break;
- // }
- // }
- // }
- // } else {
- // const len = this.lines;
- // for (var i = len - 1; i >= 0 && valid; i--) {
- // if(!this.value[i].type.isCompatilbe(subtype)) {
- // valid = false;
- // break;
- // }
- // }
- // }
- // Cannot validate type since no information on variables literals are available
- return valid;
- }
- }, {
- key: "validateSize",
- value: function validateSize() {
- var valid = true; // if(this.columns !== null) {
- // const equalityTest = this.value.map(v => v.value.length)
- // .reduce((old, next) => {
- // console.log(next);
- // if (old == null) {
- // return next;
- // } else if (old === next) {
- // return old
- // } else {
- // return -1;
- // }
- // }, null);
- // valid = equalityTest !== -1;
- // }
- // check is now made inside IVProgParser.parseVectorList(...)
- return valid;
- }
- }, {
- key: "toString",
- value: function toString() {
- var strList = this.value.map(function (arrayLiteral) {
- return arrayLiteral.toString();
- });
- var text = "{" + strList.join(',') + "}";
- if (this.parenthesis) {
- return "(".concat(text, ")");
- } else {
- return text;
- }
- }
- }, {
- key: "subtype",
- get: function get() {
- var element = this.value[0];
- if (element instanceof ArrayLiteral) {
- return element.value[0].type;
- } else {
- return element.type;
- }
- }
- }, {
- key: "lines",
- get: function get() {
- return this.value.length;
- }
- }, {
- key: "columns",
- get: function get() {
- var element = this.value[0];
- if (!(element instanceof ArrayLiteral)) {
- return null;
- } else {
- return element.value.length;
- }
- }
- }, {
- key: "isVector",
- get: function get() {
- return this.columns === null;
- }
- }, {
- key: "isValid",
- get: function get() {
- return this.validateSize() && this.validateType();
- }
- }]);
- return ArrayLiteral;
- }(_literal__WEBPACK_IMPORTED_MODULE_5__.Literal);
- /***/ }),
- /***/ "./js/ast/expressions/boolLiteral.js":
- /*!*******************************************!*\
- !*** ./js/ast/expressions/boolLiteral.js ***!
- \*******************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "BoolLiteral": () => (/* binding */ BoolLiteral)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
- /* harmony import */ var _literal__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
- /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.ts");
- /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
- 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); }; }
- 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; } }
- var BoolLiteral = /*#__PURE__*/function (_Literal) {
- _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(BoolLiteral, _Literal);
- var _super = _createSuper(BoolLiteral);
- function BoolLiteral(value) {
- var _this;
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, BoolLiteral);
- _this = _super.call(this, _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__.Types.BOOLEAN);
- _this.value = value;
- return _this;
- }
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(BoolLiteral, [{
- key: "toString",
- value: function toString() {
- var text = (0,_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_7__.convertBoolToString)(this.value);
- if (this.parenthesis) {
- return "(".concat(text, ")");
- } else {
- return text;
- }
- }
- }]);
- return BoolLiteral;
- }(_literal__WEBPACK_IMPORTED_MODULE_5__.Literal);
- /***/ }),
- /***/ "./js/ast/expressions/charLiteral.js":
- /*!*******************************************!*\
- !*** ./js/ast/expressions/charLiteral.js ***!
- \*******************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "CharLiteral": () => (/* binding */ CharLiteral)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
- /* harmony import */ var _literal__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
- /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.ts");
- 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); }; }
- 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; } }
- var CharLiteral = /*#__PURE__*/function (_Literal) {
- _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(CharLiteral, _Literal);
- var _super = _createSuper(CharLiteral);
- function CharLiteral(value) {
- var _this;
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, CharLiteral);
- _this = _super.call(this, _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__.Types.CHAR);
- _this.value = value;
- return _this;
- }
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(CharLiteral, [{
- key: "toString",
- value: function toString() {
- var text = "'".concat(this.value, "'");
- if (this.parenthesis) {
- return "(".concat(text, ")");
- } else {
- return text;
- }
- }
- }]);
- return CharLiteral;
- }(_literal__WEBPACK_IMPORTED_MODULE_5__.Literal);
- /***/ }),
- /***/ "./js/ast/expressions/expression.js":
- /*!******************************************!*\
- !*** ./js/ast/expressions/expression.js ***!
- \******************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "Expression": () => (/* binding */ Expression)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
- var Expression = /*#__PURE__*/function () {
- function Expression() {
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, Expression);
- this._sourceInfo = null;
- this._parenthesis = false;
- }
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(Expression, [{
- key: "sourceInfo",
- set: function set(sourceInfo) {
- this._sourceInfo = sourceInfo;
- },
- get: function get() {
- return this._sourceInfo;
- }
- }, {
- key: "parenthesis",
- set: function set(flag) {
- this._parenthesis = flag;
- },
- get: function get() {
- return this._parenthesis;
- }
- }]);
- return Expression;
- }();
- /***/ }),
- /***/ "./js/ast/expressions/functionCall.js":
- /*!********************************************!*\
- !*** ./js/ast/expressions/functionCall.js ***!
- \********************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "FunctionCall": () => (/* binding */ FunctionCall)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
- /* harmony import */ var _expression__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
- /* harmony import */ var _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../processor/definedFunctions */ "./js/processor/definedFunctions.js");
- 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); }; }
- 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; } }
- var FunctionCall = /*#__PURE__*/function (_Expression) {
- _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(FunctionCall, _Expression);
- var _super = _createSuper(FunctionCall);
- /**
- *
- * @param {string} id
- * @param {Expression[]} actualParameters
- */
- function FunctionCall(id, actualParameters) {
- var _this;
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, FunctionCall);
- _this = _super.call(this);
- _this.id = id;
- _this.actualParameters = actualParameters;
- return _this;
- }
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(FunctionCall, [{
- key: "toString",
- value: function toString() {
- var name = null;
- if (this.isMainCall) {
- name = _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_6__.LanguageDefinedFunction.getMainFunctionName();
- } else {
- name = _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_6__.LanguageDefinedFunction.getLocalName(this.id);
- }
- var params = null;
- if (this.actualParameters.length == 0) {
- params = "()";
- } else {
- var strParams = this.actualParameters.map(function (v) {
- return v.toString();
- });
- params = "(" + strParams.join(",") + ")";
- }
- if (this.parenthesis) {
- return "(".concat(name + params, ")");
- } else {
- return name + params;
- }
- }
- }, {
- key: "isMainCall",
- get: function get() {
- return this.id === null;
- }
- }, {
- key: "parametersSize",
- get: function get() {
- return this.actualParameters.length;
- }
- }]);
- return FunctionCall;
- }(_expression__WEBPACK_IMPORTED_MODULE_5__.Expression);
- /***/ }),
- /***/ "./js/ast/expressions/index.js":
- /*!*************************************!*\
- !*** ./js/ast/expressions/index.js ***!
- \*************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "ArrayAccess": () => (/* reexport safe */ _arrayAccess__WEBPACK_IMPORTED_MODULE_0__.ArrayAccess),
- /* harmony export */ "FunctionCall": () => (/* reexport safe */ _functionCall__WEBPACK_IMPORTED_MODULE_1__.FunctionCall),
- /* harmony export */ "IntLiteral": () => (/* reexport safe */ _intLiteral__WEBPACK_IMPORTED_MODULE_2__.IntLiteral),
- /* harmony export */ "RealLiteral": () => (/* reexport safe */ _realLiteral__WEBPACK_IMPORTED_MODULE_3__.RealLiteral),
- /* harmony export */ "BoolLiteral": () => (/* reexport safe */ _boolLiteral__WEBPACK_IMPORTED_MODULE_4__.BoolLiteral),
- /* harmony export */ "CharLiteral": () => (/* reexport safe */ _charLiteral__WEBPACK_IMPORTED_MODULE_5__.CharLiteral),
- /* harmony export */ "StringLiteral": () => (/* reexport safe */ _stringLiteral__WEBPACK_IMPORTED_MODULE_6__.StringLiteral),
- /* harmony export */ "ArrayLiteral": () => (/* reexport safe */ _arrayLiteral__WEBPACK_IMPORTED_MODULE_7__.ArrayLiteral),
- /* harmony export */ "VariableLiteral": () => (/* reexport safe */ _variableLiteral__WEBPACK_IMPORTED_MODULE_8__.VariableLiteral),
- /* harmony export */ "InfixApp": () => (/* reexport safe */ _infixApp__WEBPACK_IMPORTED_MODULE_9__.InfixApp),
- /* harmony export */ "UnaryApp": () => (/* reexport safe */ _unaryApp__WEBPACK_IMPORTED_MODULE_10__.UnaryApp)
- /* harmony export */ });
- /* harmony import */ var _arrayAccess__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./arrayAccess */ "./js/ast/expressions/arrayAccess.js");
- /* harmony import */ var _functionCall__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./functionCall */ "./js/ast/expressions/functionCall.js");
- /* harmony import */ var _intLiteral__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./intLiteral */ "./js/ast/expressions/intLiteral.js");
- /* harmony import */ var _realLiteral__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./realLiteral */ "./js/ast/expressions/realLiteral.js");
- /* harmony import */ var _boolLiteral__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./boolLiteral */ "./js/ast/expressions/boolLiteral.js");
- /* harmony import */ var _charLiteral__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./charLiteral */ "./js/ast/expressions/charLiteral.js");
- /* harmony import */ var _stringLiteral__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./stringLiteral */ "./js/ast/expressions/stringLiteral.js");
- /* harmony import */ var _arrayLiteral__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./arrayLiteral */ "./js/ast/expressions/arrayLiteral.js");
- /* harmony import */ var _variableLiteral__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./variableLiteral */ "./js/ast/expressions/variableLiteral.js");
- /* harmony import */ var _infixApp__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./infixApp */ "./js/ast/expressions/infixApp.js");
- /* harmony import */ var _unaryApp__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./unaryApp */ "./js/ast/expressions/unaryApp.js");
- /***/ }),
- /***/ "./js/ast/expressions/infixApp.js":
- /*!****************************************!*\
- !*** ./js/ast/expressions/infixApp.js ***!
- \****************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "InfixApp": () => (/* binding */ InfixApp)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
- /* harmony import */ var _expression__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
- 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); }; }
- 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; } }
- var InfixApp = /*#__PURE__*/function (_Expression) {
- _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(InfixApp, _Expression);
- var _super = _createSuper(InfixApp);
- function InfixApp(op, left, right) {
- var _this;
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, InfixApp);
- _this = _super.call(this);
- _this.op = op;
- _this.left = left;
- _this.right = right;
- return _this;
- }
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(InfixApp, [{
- key: "toString",
- value: function toString() {
- var l = this.left.toString();
- var op = this.op.value;
- var r = this.right.toString();
- if (this.parenthesis) {
- return "(".concat(l + op + r, ")");
- } else {
- return l + op + r;
- }
- }
- }]);
- return InfixApp;
- }(_expression__WEBPACK_IMPORTED_MODULE_5__.Expression);
- /***/ }),
- /***/ "./js/ast/expressions/intLiteral.js":
- /*!******************************************!*\
- !*** ./js/ast/expressions/intLiteral.js ***!
- \******************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "IntLiteral": () => (/* binding */ IntLiteral)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
- /* harmony import */ var _literal__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
- /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.ts");
- /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
- 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); }; }
- 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; } }
- var IntLiteral = /*#__PURE__*/function (_Literal) {
- _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(IntLiteral, _Literal);
- var _super = _createSuper(IntLiteral);
- function IntLiteral(value) {
- var _this;
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, IntLiteral);
- _this = _super.call(this, _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__.Types.INTEGER);
- _this.value = value;
- return _this;
- }
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(IntLiteral, [{
- key: "toString",
- value: function toString() {
- var text = (0,_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_7__.convertToString)(this.value, this.type);
- if (this.parenthesis) {
- return "(".concat(text, ")");
- } else {
- return text;
- }
- }
- }]);
- return IntLiteral;
- }(_literal__WEBPACK_IMPORTED_MODULE_5__.Literal);
- /***/ }),
- /***/ "./js/ast/expressions/literal.js":
- /*!***************************************!*\
- !*** ./js/ast/expressions/literal.js ***!
- \***************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "Literal": () => (/* binding */ Literal)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__);
- /* harmony import */ var _expression__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
- 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); }; }
- 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; } }
- var Literal = /*#__PURE__*/function (_Expression) {
- _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default()(Literal, _Expression);
- var _super = _createSuper(Literal);
- function Literal(type) {
- var _this;
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, Literal);
- _this = _super.call(this);
- _this.type = type;
- return _this;
- }
- return Literal;
- }(_expression__WEBPACK_IMPORTED_MODULE_4__.Expression);
- /***/ }),
- /***/ "./js/ast/expressions/realLiteral.js":
- /*!*******************************************!*\
- !*** ./js/ast/expressions/realLiteral.js ***!
- \*******************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "RealLiteral": () => (/* binding */ RealLiteral)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
- /* harmony import */ var _literal__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
- /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.ts");
- /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
- 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); }; }
- 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; } }
- var RealLiteral = /*#__PURE__*/function (_Literal) {
- _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(RealLiteral, _Literal);
- var _super = _createSuper(RealLiteral);
- function RealLiteral(value) {
- var _this;
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, RealLiteral);
- _this = _super.call(this, _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__.Types.REAL);
- _this.value = value;
- return _this;
- }
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(RealLiteral, [{
- key: "toString",
- value: function toString() {
- var text = (0,_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_7__.convertToString)(this.value, this.type);
- if (this.parenthesis) {
- return "(".concat(text, ")");
- } else {
- return text;
- }
- }
- }]);
- return RealLiteral;
- }(_literal__WEBPACK_IMPORTED_MODULE_5__.Literal);
- /***/ }),
- /***/ "./js/ast/expressions/stringLiteral.js":
- /*!*********************************************!*\
- !*** ./js/ast/expressions/stringLiteral.js ***!
- \*********************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "StringLiteral": () => (/* binding */ StringLiteral)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
- /* harmony import */ var _literal__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
- /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.ts");
- 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); }; }
- 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; } }
- var StringLiteral = /*#__PURE__*/function (_Literal) {
- _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(StringLiteral, _Literal);
- var _super = _createSuper(StringLiteral);
- function StringLiteral(value) {
- var _this;
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, StringLiteral);
- _this = _super.call(this, _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__.Types.STRING);
- _this.value = value;
- return _this;
- }
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(StringLiteral, [{
- key: "toString",
- value: function toString() {
- var text = '"' + this.value + '"';
- if (this.parenthesis) {
- return "(".concat(text, ")");
- } else {
- return text;
- }
- }
- }]);
- return StringLiteral;
- }(_literal__WEBPACK_IMPORTED_MODULE_5__.Literal);
- /***/ }),
- /***/ "./js/ast/expressions/unaryApp.js":
- /*!****************************************!*\
- !*** ./js/ast/expressions/unaryApp.js ***!
- \****************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "UnaryApp": () => (/* binding */ UnaryApp)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
- /* harmony import */ var _infixApp__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./infixApp */ "./js/ast/expressions/infixApp.js");
- 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); }; }
- 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; } }
- var UnaryApp = /*#__PURE__*/function (_InfixApp) {
- _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(UnaryApp, _InfixApp);
- var _super = _createSuper(UnaryApp);
- function UnaryApp(op, left) {
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, UnaryApp);
- return _super.call(this, op, left, null);
- }
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(UnaryApp, [{
- key: "toString",
- value: function toString() {
- var l = this.left.toString();
- var op = this.op.value;
- if (this.parenthesis) {
- return "(".concat(op + l, ")");
- } else {
- return op + l;
- }
- }
- }]);
- return UnaryApp;
- }(_infixApp__WEBPACK_IMPORTED_MODULE_5__.InfixApp);
- /***/ }),
- /***/ "./js/ast/expressions/variableLiteral.js":
- /*!***********************************************!*\
- !*** ./js/ast/expressions/variableLiteral.js ***!
- \***********************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "VariableLiteral": () => (/* binding */ VariableLiteral)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
- /* harmony import */ var _literal__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
- /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.ts");
- 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); }; }
- 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; } }
- var VariableLiteral = /*#__PURE__*/function (_Literal) {
- _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(VariableLiteral, _Literal);
- var _super = _createSuper(VariableLiteral);
- function VariableLiteral(id) {
- var _this;
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, VariableLiteral);
- _this = _super.call(this, _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__.Types.UNDEFINED);
- _this.id = id;
- return _this;
- }
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(VariableLiteral, [{
- key: "toString",
- value: function toString() {
- if (this.parenthesis) {
- return "(".concat(this.id, ")");
- } else {
- return this.id;
- }
- }
- }]);
- return VariableLiteral;
- }(_literal__WEBPACK_IMPORTED_MODULE_5__.Literal);
- /***/ }),
- /***/ "./js/ast/ivprogParser.js":
- /*!********************************!*\
- !*** ./js/ast/ivprogParser.js ***!
- \********************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "IVProgParser": () => (/* binding */ IVProgParser)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "./node_modules/@babel/runtime/helpers/slicedToArray.js");
- /* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _expressions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./expressions */ "./js/ast/expressions/index.js");
- /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./commands */ "./js/ast/commands/index.js");
- /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../typeSystem/parsers */ "./js/typeSystem/parsers.js");
- /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../typeSystem/types */ "./js/typeSystem/types.ts");
- /* harmony import */ var _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../typeSystem/array_type */ "./js/typeSystem/array_type.ts");
- /* harmony import */ var _sourceInfo__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./sourceInfo */ "./js/ast/sourceInfo.js");
- /* harmony import */ var _operators__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./operators */ "./js/ast/operators.ts");
- /* harmony import */ var _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./error/syntaxErrorFactory */ "./js/ast/error/syntaxErrorFactory.js");
- /* harmony import */ var _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../processor/definedFunctions */ "./js/processor/definedFunctions.js");
- /* harmony import */ var _services_languageService__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.ts");
- var IVProgParser = /*#__PURE__*/function () {
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2___default()(IVProgParser, null, [{
- key: "createParser",
- value: function createParser(input) {
- var fill = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
- var lexer = _services_languageService__WEBPACK_IMPORTED_MODULE_12__.LanguageService.getCurrentLexer();
- var parser = new IVProgParser(input, lexer);
- if (fill) {
- parser.fill();
- }
- return parser;
- } // <BEGIN scope consts>
- }, {
- key: "BASE",
- get: function get() {
- return 0;
- }
- }, {
- key: "FUNCTION",
- get: function get() {
- return 1;
- }
- }, {
- key: "COMMAND",
- get: function get() {
- return 2;
- }
- }, {
- key: "BREAKABLE",
- get: function get() {
- return 4;
- } // </ END scope consts>
- //
- }, {
- key: "EOF_TOKEN",
- get: function get() {
- return {
- text: null,
- line: -1,
- col: -1,
- value: null,
- offset: -1,
- lineBreaks: false,
- type: "EOF"
- };
- }
- /**
- * @param {string} input
- * @param {IVProgLexer} ivprogLexer
- **/
- }]);
- function IVProgParser(input, ivprogLexer) {
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, IVProgParser);
- this.ivprogLexer = ivprogLexer;
- this.inputStream = input;
- this.lexer = ivprogLexer.lexer;
- this.tokenStream = [];
- this.pos = 0;
- this.ruleNames = ivprogLexer.getRules();
- this.variableTypes = Object.entries(this.ivprogLexer.getTypeKeys()).map(function (_ref) {
- var _ref2 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default()(_ref, 2),
- key = _ref2[0],
- _ = _ref2[1];
- return key;
- });
- this.functionTypes = this.variableTypes.concat(this.ruleNames.RK_VOID);
- this.parsingArrayDimension = 0;
- this.scope = [];
- this.langFuncs = this.ivprogLexer.getLangFuncs();
- this.definedFuncsNameList = [];
- this.definedVariablesStack = [];
- }
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2___default()(IVProgParser, [{
- key: "fill",
- value: function fill() {
- var _this = this;
- var stream = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
- if (stream) {
- this.tokenStream = stream;
- return;
- }
- this.tokenStream = Array.from(this.lexer.reset(this.inputStream));
- this.tokenStream = this.tokenStream.filter(function (token) {
- // Throws an exception in case of invalid syntax
- if (token.type === _this.ruleNames.ERROR) {
- var text = token.text;
- var line = token.line;
- var column = token.col;
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.invalid_syntax(text, line, column);
- } // remove all whitespaces token and comments
- return token.type !== _this.ruleNames.WHITESPACE && token.type !== _this.ruleNames.COMMENTS;
- });
- }
- }, {
- key: "parseTree",
- value: function parseTree() {
- return this.parseProgram();
- }
- /**
- * @param {number} index
- * @return {moo.Token}
- * */
- }, {
- key: "getToken",
- value: function getToken() {
- var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.pos;
- // if(index === null)
- // index = this.pos;
- if (index >= this.tokenStream.length) {
- return IVProgParser.EOF_TOKEN;
- }
- return this.tokenStream[index];
- }
- }, {
- key: "insideScope",
- value: function insideScope(scope) {
- if (this.scope.length <= 0) {
- return IVProgParser.BASE === scope;
- } else {
- return this.scope[this.scope.length - 1] === scope;
- }
- }
- }, {
- key: "pushScope",
- value: function pushScope(scope) {
- this.scope.push(scope);
- }
- }, {
- key: "pushVariableStack",
- value: function pushVariableStack() {
- this.definedVariablesStack.push([]);
- }
- }, {
- key: "popScope",
- value: function popScope() {
- return this.scope.pop();
- }
- }, {
- key: "popVariableStack",
- value: function popVariableStack() {
- return this.definedVariablesStack.pop();
- }
- }, {
- key: "getCurrentVariableStack",
- value: function getCurrentVariableStack() {
- return this.definedVariablesStack[this.definedVariablesStack.length - 1];
- }
- }, {
- key: "isEOF",
- value: function isEOF() {
- return this.getToken(this.pos).type === IVProgParser.EOF_TOKEN.type;
- }
- }, {
- key: "parseProgram",
- value: function parseProgram() {
- this.consumeNewLines();
- var token = this.getToken();
- var globalVars = [];
- var functions = [];
- if (this.ruleNames.RK_PROGRAM === token.type) {
- this.pos++;
- this.consumeNewLines();
- this.checkOpenCurly();
- this.pos++;
- this.pushVariableStack();
- for (;;) {
- this.consumeNewLines();
- var _token = this.getToken();
- if (_token.type === this.ruleNames.RK_CONST || this.isVariableType(_token)) {
- globalVars = globalVars.concat(this.parseGlobalVariables());
- } else if (_token.type === this.ruleNames.RK_FUNCTION) {
- this.pushVariableStack();
- functions = functions.concat(this.parseFunction());
- this.popVariableStack();
- } else {
- break;
- }
- }
- this.consumeNewLines();
- this.checkCloseCurly();
- this.pos++;
- this.consumeNewLines();
- if (!this.isEOF()) {
- console.log(this.getToken());
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.extra_lines();
- }
- this.popVariableStack();
- return {
- global: globalVars,
- functions: functions
- };
- } else {
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.token_missing_one(this.ivprogLexer.getReservedKeys()[this.ruleNames.RK_PROGRAM], token);
- }
- }
- }, {
- key: "checkOpenCurly",
- value: function checkOpenCurly() {
- var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
- var token = this.getToken();
- if (this.ruleNames.OPEN_CURLY !== token.type) {
- if (!attempt) throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.token_missing_one("{", token);else return false;
- }
- return true;
- }
- }, {
- key: "checkCloseCurly",
- value: function checkCloseCurly() {
- var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
- var token = this.getToken();
- if (this.ruleNames.CLOSE_CURLY !== token.type) {
- if (!attempt) throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.token_missing_one("}", token);else return false;
- }
- return true;
- }
- /* It checks if the current token at position pos is a ']'.
- * As a check function it doesn't increment pos.
- *
- * @params bool:attempt, indicates that the token is optional. Defaults: false
- *
- * @returns true if the attempt is true and current token is '[',
- * false is attempt is true and current token is not '['
- **/
- }, {
- key: "checkOpenBrace",
- value: function checkOpenBrace() {
- var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
- var token = this.getToken();
- if (this.ruleNames.OPEN_BRACE !== token.type) {
- if (!attempt) {
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.token_missing_one("[", token);
- } else {
- return false;
- }
- }
- return true;
- }
- }, {
- key: "checkCloseBrace",
- value: function checkCloseBrace() {
- var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
- var token = this.getToken();
- if (this.ruleNames.CLOSE_BRACE !== token.type) {
- if (!attempt) {
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.token_missing_one("]", token);
- } else {
- return false;
- }
- }
- return true;
- }
- }, {
- key: "checkOpenParenthesis",
- value: function checkOpenParenthesis() {
- var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
- var token = this.getToken();
- if (this.ruleNames.OPEN_PARENTHESIS !== token.type) {
- if (!attempt) {
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.token_missing_one("(", token);
- } else {
- return false;
- }
- }
- return true;
- }
- }, {
- key: "checkCloseParenthesis",
- value: function checkCloseParenthesis() {
- var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
- var token = this.getToken();
- if (this.ruleNames.CLOSE_PARENTHESIS !== token.type) {
- if (!attempt) {
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.token_missing_one(")", token);
- } else {
- return false;
- }
- }
- return true;
- }
- }, {
- key: "checkEOS",
- value: function checkEOS() {
- var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
- var eosToken = this.getToken();
- if (eosToken.type !== this.ruleNames.EOS) {
- if (!attempt) throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.eos_missing(eosToken);else return false;
- }
- return true;
- }
- }, {
- key: "checkFunctionDuplicate",
- value: function checkFunctionDuplicate(functionID, funcIDToken) {
- var id = functionID === null ? "$main" : functionID;
- var index = this.definedFuncsNameList.indexOf(id);
- if (index !== -1) {
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.duplicate_function(funcIDToken);
- }
- this.definedFuncsNameList.push(id);
- }
- }, {
- key: "checkVariableDuplicate",
- value: function checkVariableDuplicate(variableID, sourceInfo) {
- var index = this.getCurrentVariableStack().indexOf(variableID);
- if (index !== -1) {
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.duplicate_variable(sourceInfo);
- }
- this.getCurrentVariableStack().push(variableID);
- }
- }, {
- key: "consumeForSemiColon",
- value: function consumeForSemiColon() {
- var eosToken = this.getToken();
- if (eosToken.type === this.ruleNames.EOS && eosToken.text.match("^;$")) {
- this.pos++;
- return;
- }
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.token_missing_one(";", eosToken);
- }
- }, {
- key: "parseGlobalVariables",
- value: function parseGlobalVariables() {
- var decl = this.parseMaybeConst();
- this.checkEOS();
- this.pos++;
- return decl;
- }
- /*
- * Checks if the next token is PR_CONST. It's only available
- * at global variables declaration level
- * @returns Declararion(const, type, id, initVal?)
- **/
- }, {
- key: "parseMaybeConst",
- value: function parseMaybeConst() {
- var constToken = this.getToken();
- if (constToken.type === this.ruleNames.RK_CONST) {
- this.pos++;
- var typeString = this.parseType();
- return this.parseDeclaration(typeString, true);
- } else if (this.isVariableType(constToken)) {
- var _typeString = this.parseType();
- return this.parseDeclaration(_typeString);
- } else {
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.token_missing_list([this.ivprogLexer.getReservedKeys()[this.ruleNames.RK_CONST]].concat(this.getTypeArray()), constToken);
- }
- }
- /**
- * Parses a declarion of the form: type --- id --- (= --- EAnd)?
- * @return {Commands.Declartion[]} a list of Declararion(const, type, id, initVal?)
- **/
- }, {
- key: "parseDeclaration",
- value: function parseDeclaration(typeString) {
- var isConst = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- var initial = null;
- var dim1 = null;
- var dim2 = null;
- var dimensions = 0;
- var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(this.getToken());
- var idString = this.parseID();
- this.checkVariableDuplicate(idString, sourceInfo); // Check for array or vector
- // ID[int/IDi?][int/IDj?]
- if (this.checkOpenBrace(true)) {
- this.pos += 1;
- this.consumeNewLines();
- dim1 = this.parseArrayDimension();
- this.consumeNewLines();
- this.checkCloseBrace();
- this.pos += 1;
- dimensions += 1;
- if (this.checkOpenBrace(true)) {
- this.pos += 1;
- this.consumeNewLines();
- dim2 = this.parseArrayDimension();
- this.consumeNewLines();
- this.checkCloseBrace();
- this.pos += 1;
- dimensions += 1;
- }
- return this.parseArrayDeclaration(typeString, isConst, idString, sourceInfo, dimensions, dim1, dim2);
- } else {
- var assignmentToken = this.getToken();
- if (isConst && assignmentToken.type !== this.ruleNames.ASSIGNMENT) {
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.const_not_init(sourceInfo);
- }
- if (assignmentToken.type === this.ruleNames.ASSIGNMENT) {
- this.pos++;
- initial = this.parseExpressionOR();
- }
- var declaration = new _commands__WEBPACK_IMPORTED_MODULE_4__.Declaration(idString, typeString, initial, isConst);
- declaration.sourceInfo = sourceInfo;
- var commaToken = this.getToken();
- if (commaToken.type === this.ruleNames.COMMA) {
- this.pos++;
- this.consumeNewLines();
- return [declaration].concat(this.parseDeclaration(typeString, isConst));
- } else {
- return [declaration];
- }
- }
- }
- }, {
- key: "parseArrayDeclaration",
- value: function parseArrayDeclaration(typeString, isConst, idString, sourceInfo, dimensions, dim1, dim2) {
- var assignmentToken = this.getToken();
- var n_lines = dim1;
- var n_columns = dim2;
- var initial = null;
- var dim_is_id = false;
- if (dim1 instanceof _expressions__WEBPACK_IMPORTED_MODULE_3__.VariableLiteral || dim2 instanceof _expressions__WEBPACK_IMPORTED_MODULE_3__.VariableLiteral) {
- dim_is_id = true;
- if (dimensions > 1 && (dim1 == null || dim2 == null)) {
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.invalid_matrix_id_dimension(_sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(assignmentToken));
- }
- }
- if (isConst && assignmentToken.type !== this.ruleNames.ASSIGNMENT) {
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.const_not_init(sourceInfo);
- }
- if (assignmentToken.type === this.ruleNames.ASSIGNMENT) {
- if (dim_is_id) {
- if (dimensions == 1) {
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.invalid_vector_init(_sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(assignmentToken));
- } else {
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.invalid_matrix_init(_sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(assignmentToken));
- }
- }
- this.pos += 1;
- initial = this.parseArrayLiteral(typeString);
- }
- if (initial == null && dim1 == null) {
- if (dimensions > 1) {
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.cannot_infer_matrix_line(idString, sourceInfo);
- }
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.cannot_infer_vector_size(idString, sourceInfo);
- }
- if (dimensions > 1) {
- if (initial == null && dim2 == null) {
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.cannot_infer_matrix_column(idString, sourceInfo);
- }
- }
- if (dimensions === 1 && initial != null && !initial.isVector) {
- var expString = initial.toString();
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.matrix_to_vector_literal_attr(idString, expString, initial.sourceInfo);
- } else if (dimensions > 1 && initial != null && initial.isVector) {
- var _expString = initial.toString();
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.vector_to_matrix_literal_attr(idString, _expString, initial.sourceInfo);
- }
- if (dim1 == null) {
- n_lines = new _expressions__WEBPACK_IMPORTED_MODULE_3__.IntLiteral(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_5__.toInt(initial.lines));
- n_lines.sourceInfo = sourceInfo;
- }
- if (dimensions > 1) {
- if (dim2 == null) {
- n_columns = new _expressions__WEBPACK_IMPORTED_MODULE_3__.IntLiteral(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_5__.toInt(initial.columns));
- n_columns.sourceInfo = sourceInfo;
- }
- }
- 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);
- declaration.sourceInfo = sourceInfo;
- var commaToken = this.getToken();
- if (commaToken.type === this.ruleNames.COMMA) {
- this.pos++;
- this.consumeNewLines();
- return [declaration].concat(this.parseDeclaration(typeString, isConst));
- } else {
- return [declaration];
- }
- }
- }, {
- key: "consumeNewLines",
- value: function consumeNewLines() {
- var token = this.getToken();
- while (token && token.type === this.ruleNames.EOS && token.text.match("^[\r\n]+$")) {
- this.pos++;
- token = this.getToken();
- }
- }
- }, {
- key: "isVariableType",
- value: function isVariableType(token) {
- return this.variableTypes.find(function (v) {
- return v === token.type;
- });
- }
- /**
- * Reads the next token of the stream to check if it is a Integer or an ID.
- * @returns Integer | ID
- **/
- }, {
- key: "parseArrayDimension",
- value: function parseArrayDimension() {
- var dimToken = this.getToken();
- if (dimToken.type === this.ruleNames.INTEGER) {
- //parse as int literal
- this.pos++;
- return this.getIntLiteral(dimToken);
- } else if (dimToken.type === this.ruleNames.ID) {
- //parse as variable
- this.pos++;
- return this.parseVariable(dimToken);
- } else if (dimToken.type === this.ruleNames.CLOSE_BRACE) {
- return null;
- } else {
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.invalid_array_dimension(this.ivprogLexer.getReservedKeys()[this.ruleNames.RK_INTEGER], dimToken);
- }
- }
- /**
- * Returns an object {type: 'int', value: value}.
- * It checks for binary and hexadecimal integers.
- * @param {moo.Token} token
- * @return {Object} object with fields type and value
- **/
- }, {
- key: "getIntLiteral",
- value: function getIntLiteral(token) {
- var text = token.text;
- var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(token);
- var exp = new _expressions__WEBPACK_IMPORTED_MODULE_3__.IntLiteral(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_5__.toInt(text));
- exp.sourceInfo = sourceInfo;
- return exp;
- }
- }, {
- key: "getRealLiteral",
- value: function getRealLiteral(token) {
- var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(token);
- var exp = new _expressions__WEBPACK_IMPORTED_MODULE_3__.RealLiteral(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_5__.toReal(token.text));
- exp.sourceInfo = sourceInfo;
- return exp;
- }
- }, {
- key: "getStringLiteral",
- value: function getStringLiteral(token) {
- var text = token.text;
- var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(token);
- var exp = new _expressions__WEBPACK_IMPORTED_MODULE_3__.StringLiteral(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_5__.toString(text));
- exp.sourceInfo = sourceInfo;
- return exp;
- }
- }, {
- key: "getCharLiteral",
- value: function getCharLiteral(token) {
- var text = token.text;
- var exp = new _expressions__WEBPACK_IMPORTED_MODULE_3__.CharLiteral(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_5__.toChar(text));
- exp.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(token);
- return exp;
- }
- }, {
- key: "getBoolLiteral",
- value: function getBoolLiteral(token) {
- var val = _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_5__.toBool(token.text);
- var exp = new _expressions__WEBPACK_IMPORTED_MODULE_3__.BoolLiteral(val);
- exp.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(token);
- return exp;
- }
- }, {
- key: "parseArrayLiteral",
- value: function parseArrayLiteral(typeString) {
- var openCurly = this.checkOpenCurly(true);
- if (!openCurly) {
- var invalid_token = this.getToken();
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.array_init_not_literal(_sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(invalid_token));
- }
- var beginArray = this.getToken();
- if (this.parsingArrayDimension >= 2) {
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.array_exceeds_2d(_sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(beginArray));
- }
- this.pos += 1;
- this.parsingArrayDimension += 1;
- this.consumeNewLines();
- var data = null;
- var maybeCurlyOpen = this.checkOpenCurly(true);
- if (maybeCurlyOpen) {
- // This is potentially a list of vectors
- data = this.parseVectorList(typeString);
- } else {
- data = this.parseExpressionList();
- }
- this.consumeNewLines();
- this.checkCloseCurly();
- var endArray = this.getToken();
- this.pos += 1;
- this.parsingArrayDimension -= 1;
- var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfoFromList(beginArray, endArray);
- var dataDim = 1;
- if (data[0] instanceof _expressions__WEBPACK_IMPORTED_MODULE_3__.ArrayLiteral) {
- dataDim += 1;
- } else if (data.length == 1) {
- console.log("Talvez uma variável seja uma melhor opção");
- }
- var type = new _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_7__.ArrayType(typeString, dataDim);
- var exp = new _expressions__WEBPACK_IMPORTED_MODULE_3__.ArrayLiteral(type, data);
- exp.sourceInfo = sourceInfo;
- return exp;
- }
- /**
- * Returns a list of ArrayLiterals. Helper function for parsing matrices
- */
- }, {
- key: "parseVectorList",
- value: function parseVectorList(typeString) {
- var list = [];
- var lastSize = null;
- for (;;) {
- this.checkOpenCurly();
- var beginArray = this.getToken();
- if (this.parsingArrayDimension >= 2) {
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.array_exceeds_2d(_sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(beginArray));
- }
- this.pos += 1;
- this.parsingArrayDimension += 1;
- this.consumeNewLines();
- var data = this.parseExpressionList();
- this.consumeNewLines();
- this.checkCloseCurly();
- var endArray = this.getToken();
- this.pos += 1;
- this.parsingArrayDimension -= 1;
- var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfoFromList(beginArray, endArray);
- if (lastSize == null) {
- lastSize = data.length;
- } else if (lastSize !== data.length) {
- var expString = this.inputStream.substring(beginArray.offset, endArray.offset + endArray.text.length);
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.invalid_matrix_literal_line(expString, sourceInfo);
- }
- var type = new _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_7__.ArrayType(typeString, 1);
- var exp = new _expressions__WEBPACK_IMPORTED_MODULE_3__.ArrayLiteral(type, data);
- exp.sourceInfo = sourceInfo;
- list.push(exp);
- var commaToken = this.getToken();
- if (commaToken.type !== this.ruleNames.COMMA) {
- break;
- }
- this.pos += 1;
- this.consumeNewLines();
- }
- if (list.length == 1) {
- console.log("Talvez um vetor seja uma melhor opção");
- }
- return list;
- }
- /*
- * Returns an object {type: 'variable', value: value}.
- * @returns object with fields type and value
- **/
- }, {
- key: "parseVariable",
- value: function parseVariable(token) {
- var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(token);
- var exp = new _expressions__WEBPACK_IMPORTED_MODULE_3__.VariableLiteral(token.text);
- exp.sourceInfo = sourceInfo;
- return exp;
- }
- /*
- * Returns an object representing a function. It has
- * four attributes: returnType, id, formalParams and block.
- * The block object has two attributes: declarations and commands
- **/
- }, {
- key: "parseFunction",
- value: function parseFunction() {
- this.pushScope(IVProgParser.FUNCTION);
- var formalParams = [];
- var token = this.getToken();
- if (token.type !== this.ruleNames.RK_FUNCTION) {
- //throw SyntaxError.createError(this.lexer.literalNames[this.lexerClass.PR_FUNCAO], token);
- return null;
- }
- this.pos++;
- var funType = this.parseType();
- var dimensions = 0;
- if (this.checkOpenBrace(true)) {
- this.pos++;
- this.checkCloseBrace();
- this.pos++;
- dimensions++;
- if (this.checkOpenBrace(true)) {
- this.pos++;
- this.checkCloseBrace();
- this.pos++;
- dimensions++;
- }
- }
- var funcIDToken = this.getToken();
- var functionID = this.parseID();
- this.checkFunctionDuplicate(functionID, funcIDToken);
- this.checkOpenParenthesis();
- this.pos++;
- this.consumeNewLines();
- if (!this.checkCloseParenthesis(true)) {
- formalParams = this.parseFormalParameters(); // formal parameters
- this.consumeNewLines();
- this.checkCloseParenthesis();
- this.pos++;
- } else {
- this.pos++;
- }
- this.consumeNewLines();
- var commandsBlock = this.parseCommandBlock();
- var returnType = funType;
- if (dimensions > 0) {
- returnType = new _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_7__.ArrayType(funType, dimensions);
- }
- var func = new _commands__WEBPACK_IMPORTED_MODULE_4__.Function(functionID, returnType, formalParams, commandsBlock);
- if (functionID === null && !func.isMain) {
- 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);
- } else if (func.isMain && formalParams.length !== 0) {
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.main_parameters();
- }
- this.popScope();
- func.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(funcIDToken);
- return func;
- }
- /*
- * Parse the formal parameters of a function.
- * @returns a list of objects with the following attributes: type, id and dimensions.
- **/
- }, {
- key: "parseFormalParameters",
- value: function parseFormalParameters() {
- var list = [];
- for (;;) {
- var dimensions = 0;
- var reference = false;
- var typeString = this.parseType();
- var maybeIDToken = this.getToken();
- if (maybeIDToken.type === this.ruleNames.RK_REFERENCE) {
- reference = true;
- this.pos += 1;
- maybeIDToken = this.getToken();
- }
- var idString = this.parseID();
- this.checkVariableDuplicate(idString, maybeIDToken);
- if (this.checkOpenBrace(true)) {
- this.pos += 1;
- dimensions += 1;
- this.checkCloseBrace();
- this.pos += 1;
- if (this.checkOpenBrace(true)) {
- this.pos += 1;
- dimensions += 1;
- this.checkCloseBrace();
- this.pos += 1;
- }
- }
- var type = null;
- if (dimensions > 0) {
- type = new _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_7__.ArrayType(typeString, dimensions);
- } else {
- type = typeString;
- }
- var parameter = new _commands__WEBPACK_IMPORTED_MODULE_4__.FormalParameter(type, idString, reference);
- parameter.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(maybeIDToken);
- list.push(parameter);
- var commaToken = this.getToken();
- if (commaToken.type !== this.ruleNames.COMMA) break;
- this.pos++;
- this.consumeNewLines();
- }
- return list;
- }
- }, {
- key: "parseID",
- value: function parseID() {
- var token = this.getToken();
- if (token.type !== this.ruleNames.ID) {
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.id_missing(token);
- }
- this.pos++;
- if (this.insideScope(IVProgParser.FUNCTION)) {
- if (token.text === _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_11__.LanguageDefinedFunction.getMainFunctionName()) {
- return null;
- }
- }
- return token.text;
- }
- /**
- * @return {string}
- **/
- }, {
- key: "parseMaybeLibID",
- value: function parseMaybeLibID() {
- var token = this.getToken();
- if (token.type !== this.ruleNames.ID) {
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.id_missing(token);
- }
- var maybeDOT = this.getToken(this.pos + 1);
- if (maybeDOT.type === this.ruleNames.DOT) {
- this.pos += 2;
- var anotherID = this.getToken();
- if (anotherID.type !== this.ruleNames.ID) {
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.id_missing(anotherID);
- }
- this.pos++;
- return "".concat(token.text, ".").concat(anotherID.text);
- }
- this.pos++;
- return token.text;
- }
- }, {
- key: "parseType",
- value: function parseType() {
- var token = this.getToken();
- if (token.type === this.ruleNames.ID && this.insideScope(IVProgParser.FUNCTION)) {
- return _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__.Types.VOID;
- } else if (token.type === this.ruleNames.RK_VOID && this.insideScope(IVProgParser.FUNCTION)) {
- this.pos++;
- return _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__.Types.VOID;
- } else if (this.isVariableType(token)) {
- this.pos++;
- switch (token.type) {
- case this.ruleNames.RK_INTEGER:
- return _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__.Types.INTEGER;
- case this.ruleNames.RK_BOOLEAN:
- return _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__.Types.BOOLEAN;
- case this.ruleNames.RK_REAL:
- return _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__.Types.REAL;
- case this.ruleNames.RK_STRING:
- return _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__.Types.STRING;
- case this.ruleNames.RK_CHARACTER:
- return _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__.Types.CHAR;
- default:
- break;
- }
- }
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.invalid_type(this.getTypeArray(), token);
- }
- }, {
- key: "parseCommandBlock",
- value: function parseCommandBlock() {
- var optionalCurly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
- var variablesDecl = [];
- var commands = [];
- var hasOpen = false;
- if (this.checkOpenCurly(optionalCurly)) {
- this.pos++;
- hasOpen = true;
- }
- this.consumeNewLines();
- var parsedCommand = false;
- for (;;) {
- var cmd = this.parseCommand();
- if (cmd === null) break;
- if (cmd !== -1) {
- if (cmd instanceof Array) {
- if (parsedCommand) {
- var lastToken = this.getToken(this.pos - 1);
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.invalid_var_declaration(lastToken);
- }
- variablesDecl = variablesDecl.concat(cmd);
- } else {
- parsedCommand = true;
- commands.push(cmd);
- }
- }
- }
- this.consumeNewLines();
- if (hasOpen) {
- this.checkCloseCurly();
- this.pos++;
- this.consumeNewLines();
- }
- return new _commands__WEBPACK_IMPORTED_MODULE_4__.CommandBlock(variablesDecl, commands);
- }
- }, {
- key: "parseCommand",
- value: function parseCommand() {
- var token = this.getToken();
- if (this.isVariableType(token)) {
- if (!this.insideScope(IVProgParser.FUNCTION)) {
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.invalid_var_declaration(token);
- }
- this.pushScope(IVProgParser.BASE);
- var varType = this.parseType();
- this.popScope();
- var cmd = this.parseDeclaration(varType);
- this.checkEOS();
- this.pos++;
- return cmd;
- } else if (token.type === this.ruleNames.ID) {
- return this.parseIDCommand();
- } else if (token.type === this.ruleNames.DOT) {
- // TODO Check if this is relevant since DOT is a replacement for antlr4 LIB_ID :=> ID . ID
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.invalid_syntax(token.text, token.line, token.col);
- } else if (token.type === this.ruleNames.RK_RETURN) {
- return this.parseReturn();
- } else if (token.type === this.ruleNames.RK_WHILE || token.type === this.ruleNames.RK_WHILE_ALT) {
- return this.parseWhile();
- } else if (token.type === this.ruleNames.RK_FOR || token.type === this.ruleNames.RK_FOR_ALT) {
- return this.parseFor();
- } else if (token.type === this.ruleNames.RK_BREAK) {
- if (!this.insideScope(IVProgParser.BREAKABLE)) {
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.invalid_break_command(this.ivprogLexer.getReservedKeys()[this.ruleNames.RK_BREAK], token);
- }
- return this.parseBreak();
- } else if (token.type === this.ruleNames.RK_SWITCH) {
- return this.parseSwitchCase();
- } else if (token.type === this.ruleNames.RK_DO) {
- return this.parseRepeatUntil();
- } else if (token.type === this.ruleNames.RK_IF) {
- return this.parseIfThenElse();
- } else if (this.checkEOS(true)) {
- this.pos++;
- return -1;
- } else {
- return null;
- }
- }
- }, {
- key: "parseSwitchCase",
- value: function parseSwitchCase() {
- var token = this.getToken();
- this.pushScope(IVProgParser.BREAKABLE);
- this.pos++;
- this.checkOpenParenthesis();
- this.pos++;
- this.consumeNewLines();
- var exp = this.parseExpressionOR();
- this.consumeNewLines();
- this.checkCloseParenthesis();
- this.pos++;
- this.consumeNewLines();
- this.checkOpenCurly();
- this.pos++;
- this.consumeNewLines();
- var casesList = this.parseCases();
- this.consumeNewLines();
- this.checkCloseCurly();
- this.pos++;
- this.consumeNewLines();
- this.popScope();
- var command = new _commands__WEBPACK_IMPORTED_MODULE_4__.Switch(exp, casesList);
- command.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(token);
- return command;
- }
- }, {
- key: "parseRepeatUntil",
- value: function parseRepeatUntil() {
- var token = this.getToken();
- this.pos++;
- this.consumeNewLines();
- this.pushScope(IVProgParser.BREAKABLE);
- var commandsBlock = this.parseCommandBlock();
- this.consumeNewLines(); //Maybe not...
- var whileToken = this.getToken();
- if (whileToken.type !== this.ruleNames.RK_DO_UNTIL) {
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.token_missing_one(this.ivprogLexer.getReservedKeys()[this.ruleNames.RK_DO_UNTIL], whileToken);
- }
- this.pos++;
- this.checkOpenParenthesis();
- this.pos++;
- this.consumeNewLines();
- var condition = this.parseExpressionOR();
- this.consumeNewLines();
- this.checkCloseParenthesis();
- this.pos++;
- this.checkEOS();
- this.popScope();
- var command = new _commands__WEBPACK_IMPORTED_MODULE_4__.RepeatUntil(condition, commandsBlock);
- command.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(token);
- return command;
- }
- }, {
- key: "parseIfThenElse",
- value: function parseIfThenElse() {
- if (this.insideScope(IVProgParser.BREAKABLE)) {
- this.pushScope(IVProgParser.BREAKABLE);
- } else {
- this.pushScope(IVProgParser.COMMAND);
- }
- var token = this.getToken();
- this.pos++;
- this.checkOpenParenthesis();
- this.pos++;
- this.consumeNewLines();
- var logicalExpression = this.parseExpressionOR();
- this.consumeNewLines();
- this.checkCloseParenthesis();
- this.pos++;
- this.consumeNewLines();
- var cmdBlocks = this.parseCommandBlock();
- var maybeElse = this.getToken();
- if (maybeElse.type === this.ruleNames.RK_ELSE) {
- this.pos++;
- this.consumeNewLines();
- var maybeIf = this.getToken();
- var elseBlock = null;
- if (this.checkOpenCurly(true)) {
- elseBlock = this.parseCommandBlock();
- } else if (maybeIf.type === this.ruleNames.RK_IF) {
- elseBlock = this.parseIfThenElse();
- } else {
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.token_missing_list([this.ivprogLexer.getReservedKeys()[this.ruleNames.RK_IF], "{"], maybeIf);
- }
- this.popScope();
- var _cmd = new _commands__WEBPACK_IMPORTED_MODULE_4__.IfThenElse(logicalExpression, cmdBlocks, elseBlock);
- _cmd.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(token);
- return _cmd;
- }
- this.popScope();
- var cmd = new _commands__WEBPACK_IMPORTED_MODULE_4__.IfThenElse(logicalExpression, cmdBlocks, null);
- cmd.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(token);
- return cmd;
- }
- }, {
- key: "parseFor",
- value: function parseFor() {
- this.pushScope(IVProgParser.BREAKABLE);
- var for_token = this.getToken();
- this.pos += 1; // parse ID
- var id_token = this.getToken();
- var id = this.parseID();
- var for_id = new _expressions__WEBPACK_IMPORTED_MODULE_3__.VariableLiteral(id);
- for_id.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(id_token); // END parse ID
- var for_from = this.parseForParameters(this.ruleNames.RK_FOR_FROM);
- var for_to = this.parseForParameters(this.ruleNames.RK_FOR_TO);
- var maybePass = this.parseForParameters(this.ruleNames.RK_FOR_PASS);
- this.consumeNewLines();
- var commandsBlock = this.parseCommandBlock();
- this.popScope();
- var cmd = new _commands__WEBPACK_IMPORTED_MODULE_4__.For(for_id, for_from, for_to, maybePass, commandsBlock);
- cmd.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(for_token);
- return cmd;
- }
- }, {
- key: "parseWhile",
- value: function parseWhile() {
- this.pushScope(IVProgParser.BREAKABLE);
- var token = this.getToken();
- this.pos++;
- this.checkOpenParenthesis();
- this.pos++;
- this.consumeNewLines();
- var logicalExpression = this.parseExpressionOR();
- this.consumeNewLines();
- this.checkCloseParenthesis();
- this.pos++;
- this.consumeNewLines();
- var cmdBlocks = this.parseCommandBlock();
- this.popScope();
- var cmd = new _commands__WEBPACK_IMPORTED_MODULE_4__.While(logicalExpression, cmdBlocks);
- cmd.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(token);
- return cmd;
- }
- }, {
- key: "parseBreak",
- value: function parseBreak() {
- var token = this.getToken();
- this.pos++;
- this.checkEOS();
- this.pos++;
- var command = new _commands__WEBPACK_IMPORTED_MODULE_4__.Break();
- command.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(token);
- return command;
- }
- }, {
- key: "parseReturn",
- value: function parseReturn() {
- var token = this.getToken();
- this.pos++;
- var exp = null;
- if (!this.checkEOS(true)) {
- exp = this.parseExpressionOR();
- this.checkEOS();
- }
- this.pos++;
- var returnCommand = new _commands__WEBPACK_IMPORTED_MODULE_4__.Return(exp);
- returnCommand.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(token);
- return returnCommand;
- }
- }, {
- key: "parseIDCommand",
- value: function parseIDCommand() {
- var refToken = this.getToken();
- var id = this.parseMaybeLibID();
- var isID = id.indexOf(".") === -1;
- if (this.checkOpenBrace(true)) {
- this.pos++;
- var lineExpression = null;
- var columnExpression = null;
- this.consumeNewLines();
- lineExpression = this.parseExpression();
- this.consumeNewLines();
- this.checkCloseBrace();
- this.pos++;
- if (this.checkOpenBrace(true)) {
- this.pos++;
- this.consumeNewLines();
- columnExpression = this.parseExpression();
- this.consumeNewLines();
- this.checkCloseBrace();
- this.pos++;
- }
- var assignmentToken = this.getToken();
- if (assignmentToken.type !== this.ruleNames.ASSIGNMENT) {
- // TODO BETTER MESSAGE
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.token_missing_one("<-", assignmentToken);
- }
- this.pos++;
- var exp = this.parseExpressionOR();
- this.checkEOS();
- this.pos++;
- var cmd = new _commands__WEBPACK_IMPORTED_MODULE_4__.ArrayIndexAssign(id, lineExpression, columnExpression, exp);
- cmd.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(assignmentToken);
- return cmd;
- }
- var assignmentOrParenthesis = this.getToken();
- if (isID && assignmentOrParenthesis.type === this.ruleNames.ASSIGNMENT) {
- this.pos++;
- var _exp = this.parseExpressionOR();
- this.checkEOS();
- this.pos++;
- var _cmd2 = new _commands__WEBPACK_IMPORTED_MODULE_4__.Assign(id, _exp);
- _cmd2.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(assignmentOrParenthesis);
- return _cmd2;
- } else if (assignmentOrParenthesis.type === this.ruleNames.OPEN_PARENTHESIS) {
- var funcCall = this.parseFunctionCallCommand(id);
- this.checkEOS();
- this.pos++;
- return funcCall;
- } else if (isID) {
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.token_missing_list(["<-", "("], assignmentOrParenthesis);
- } else {
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.invalid_id_format(refToken);
- }
- }
- }, {
- key: "parseForParameters",
- value: function parseForParameters(keyword_code) {
- if (keyword_code === this.ruleNames.RK_FOR_PASS) {
- if (this.checkOpenCurly(true)) {
- return null;
- }
- }
- var from_token = this.getToken();
- if (from_token.type !== keyword_code) {
- // TODO better error message
- var keyword = this.ivprogLexer.getReservedKeys()[keyword_code];
- throw new Error("Error de sintaxe no comando repita_para: esperava-se " + keyword + " mas encontrou " + from_token.text);
- }
- this.pos += 1;
- var int_or_id = this.getToken();
- var is_unary_op = false;
- var op = null;
- if (int_or_id.type === this.ruleNames.SUM_OP) {
- is_unary_op = true;
- op = int_or_id.text;
- this.pos += 1;
- int_or_id = this.getToken();
- }
- var for_from = null;
- if (int_or_id.type === this.ruleNames.ID) {
- for_from = new _expressions__WEBPACK_IMPORTED_MODULE_3__.VariableLiteral(this.parseID());
- for_from.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(int_or_id);
- } else if (int_or_id.type === this.ruleNames.INTEGER) {
- this.pos += 1;
- for_from = this.getIntLiteral(int_or_id);
- }
- if (for_from == null) {
- // TODO better error message
- var _keyword = this.ivprogLexer.getReservedKeys()[keyword_code];
- 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.");
- }
- if (is_unary_op) {
- for_from = new _expressions__WEBPACK_IMPORTED_MODULE_3__.UnaryApp((0,_operators__WEBPACK_IMPORTED_MODULE_9__.convertFromString)(op), for_from);
- }
- return for_from;
- }
- }, {
- key: "parseCases",
- value: function parseCases() {
- var token = this.getToken();
- if (token.type !== this.ruleNames.RK_CASE) {
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.token_missing_one(this.ivprogLexer.getReservedKeys()[this.ruleNames.RK_CASE], token);
- }
- this.pos++;
- var nextToken = this.getToken();
- if (nextToken.type === this.ruleNames.RK_DEFAULT) {
- this.pos++;
- var colonToken = this.getToken();
- if (colonToken.type !== this.ruleNames.COLON) {
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.token_missing_one(":", colonToken);
- }
- this.pos++;
- this.consumeNewLines();
- var block = this.parseCommandBlock(true);
- var defaultCase = new _commands__WEBPACK_IMPORTED_MODULE_4__.Case(null);
- defaultCase.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(token);
- defaultCase.setCommands(block.commands);
- return [defaultCase];
- } else {
- var exp = this.parseExpressionOR();
- var _colonToken = this.getToken();
- if (_colonToken.type !== this.ruleNames.COLON) {
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.token_missing_one(":", _colonToken);
- }
- this.pos++;
- this.consumeNewLines();
- var _block = this.parseCommandBlock(true);
- var aCase = new _commands__WEBPACK_IMPORTED_MODULE_4__.Case(exp);
- aCase.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(token);
- aCase.setCommands(_block.commands);
- var caseToken = this.getToken();
- if (caseToken.type === this.ruleNames.RK_CASE) {
- return [aCase].concat(this.parseCases());
- } else {
- return [aCase];
- }
- }
- }
- /*
- * Parses an Expression following the structure:
- *
- * EOR => EAnd ( 'or' EOR)? #expression and
- *
- * EAnd => ENot ('and' EAnd)? #expression or
- *
- * ENot => 'not'? ER #expression not
- *
- * ER => E ((>=, <=, ==, >, <) ER)? #expression relational
- *
- * E => factor ((+, -) E)? #expression
- *
- * factor=> term ((*, /, %) factor)?
- *
- * term => literal || arrayAccess || FuncCall || ID || '('EOR')'
- **/
- }, {
- key: "parseExpressionOR",
- value: function parseExpressionOR() {
- var exp1 = this.parseExpressionAND();
- while (this.getToken().type === this.ruleNames.OR_OPERATOR) {
- var opToken = this.getToken();
- this.pos++;
- var or = (0,_operators__WEBPACK_IMPORTED_MODULE_9__.convertFromString)("or");
- this.consumeNewLines();
- var exp2 = this.parseExpressionAND();
- var finalExp = new _expressions__WEBPACK_IMPORTED_MODULE_3__.InfixApp(or, exp1, exp2);
- finalExp.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(opToken);
- exp1 = finalExp;
- }
- return exp1;
- }
- }, {
- key: "parseExpressionAND",
- value: function parseExpressionAND() {
- var exp1 = this.parseExpressionNot();
- while (this.getToken().type === this.ruleNames.AND_OPERATOR) {
- var opToken = this.getToken();
- this.pos++;
- var and = (0,_operators__WEBPACK_IMPORTED_MODULE_9__.convertFromString)("and");
- this.consumeNewLines();
- var exp2 = this.parseExpressionNot();
- var finalExp = new _expressions__WEBPACK_IMPORTED_MODULE_3__.InfixApp(and, exp1, exp2);
- finalExp.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(opToken);
- exp1 = finalExp;
- }
- return exp1;
- }
- }, {
- key: "parseExpressionNot",
- value: function parseExpressionNot() {
- var maybeNotToken = this.getToken();
- if (maybeNotToken.type === this.ruleNames.NOT_OPERATOR) {
- var opToken = this.getToken();
- this.pos++;
- var not = (0,_operators__WEBPACK_IMPORTED_MODULE_9__.convertFromString)("not");
- var exp1 = this.parseExpressionRel();
- var finalExp = new _expressions__WEBPACK_IMPORTED_MODULE_3__.UnaryApp(not, exp1);
- finalExp.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(opToken);
- return finalExp;
- } else {
- return this.parseExpressionRel();
- }
- }
- }, {
- key: "parseExpressionRel",
- value: function parseExpressionRel() {
- var exp1 = this.parseExpression();
- while (this.getToken().type === this.ruleNames.RELATIONAL_OPERATOR) {
- var relToken = this.getToken();
- this.pos++;
- var rel = (0,_operators__WEBPACK_IMPORTED_MODULE_9__.convertFromString)(relToken.text);
- var exp2 = this.parseExpression();
- var finalExp = new _expressions__WEBPACK_IMPORTED_MODULE_3__.InfixApp(rel, exp1, exp2);
- finalExp.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(relToken);
- exp1 = finalExp;
- }
- return exp1;
- }
- }, {
- key: "parseExpression",
- value: function parseExpression() {
- var factor = this.parseFactor();
- while (this.getToken().type === this.ruleNames.SUM_OP) {
- var sumOpToken = this.getToken();
- this.pos++;
- var op = (0,_operators__WEBPACK_IMPORTED_MODULE_9__.convertFromString)(sumOpToken.text);
- var factor2 = this.parseFactor();
- var finalExp = new _expressions__WEBPACK_IMPORTED_MODULE_3__.InfixApp(op, factor, factor2);
- finalExp.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(sumOpToken);
- factor = finalExp;
- }
- return factor;
- }
- }, {
- key: "parseFactor",
- value: function parseFactor() {
- var term = this.parseTerm();
- while (this.getToken().type === this.ruleNames.MULTI_OP) {
- var multOpToken = this.getToken();
- this.pos++;
- var op = (0,_operators__WEBPACK_IMPORTED_MODULE_9__.convertFromString)(multOpToken.text);
- var term2 = this.parseTerm();
- var finalExp = new _expressions__WEBPACK_IMPORTED_MODULE_3__.InfixApp(op, term, term2);
- finalExp.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(multOpToken);
- term = finalExp;
- }
- return term;
- }
- }, {
- key: "parseTerm",
- value: function parseTerm() {
- var token = this.getToken();
- var sourceInfo = null;
- var exp = null;
- switch (token.type) {
- case this.ruleNames.SUM_OP:
- this.pos++;
- sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(token);
- exp = new _expressions__WEBPACK_IMPORTED_MODULE_3__.UnaryApp((0,_operators__WEBPACK_IMPORTED_MODULE_9__.convertFromString)(token.text), this.parseTerm());
- exp.sourceInfo = sourceInfo;
- return exp;
- case this.ruleNames.INTEGER:
- this.pos++;
- return this.getIntLiteral(token);
- case this.ruleNames.REAL:
- this.pos++;
- return this.getRealLiteral(token);
- case this.ruleNames.STRING:
- this.pos++;
- return this.getStringLiteral(token);
- case this.ruleNames.CHARACTER:
- this.pos++;
- return this.getCharLiteral(token);
- case this.ruleNames.RK_TRUE:
- case this.ruleNames.RK_FALSE:
- this.pos++;
- return this.getBoolLiteral(token);
- case this.ruleNames.OPEN_CURLY:
- // No more annonymous array
- // return this.parseArrayLiteral();
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.annonymous_array_literal(token);
- case this.ruleNames.ID:
- return this.parseIDTerm();
- case this.ruleNames.OPEN_PARENTHESIS:
- return this.parseParenthesisExp();
- default:
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.invalid_terminal(token);
- }
- }
- }, {
- key: "parseIDTerm",
- value: function parseIDTerm() {
- var tokenA = this.getToken();
- var id = this.parseMaybeLibID();
- var isID = id.indexOf(".") === -1;
- if (isID && this.checkOpenBrace(true)) {
- var tokenB = null;
- this.pos++;
- var firstIndex = this.parseExpression();
- var secondIndex = null;
- this.consumeNewLines();
- this.checkCloseBrace();
- tokenB = this.getToken();
- this.pos++;
- if (this.checkOpenBrace(true)) {
- this.pos++;
- secondIndex = this.parseExpression();
- this.consumeNewLines();
- this.checkCloseBrace();
- tokenB = this.getToken();
- this.pos++;
- }
- var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfoFromList(tokenA, tokenB);
- var exp = new _expressions__WEBPACK_IMPORTED_MODULE_3__.ArrayAccess(id, firstIndex, secondIndex);
- exp.sourceInfo = sourceInfo;
- return exp;
- } else if (this.checkOpenParenthesis(true)) {
- return this.parseFunctionCallExpression(id);
- } else if (isID) {
- var _sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(tokenA);
- var _exp2 = new _expressions__WEBPACK_IMPORTED_MODULE_3__.VariableLiteral(id);
- _exp2.sourceInfo = _sourceInfo;
- return _exp2;
- } else {
- throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.invalid_id_format(tokenA);
- }
- }
- }, {
- key: "getFunctionName",
- value: function getFunctionName(id) {
- var name = _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_11__.LanguageDefinedFunction.getInternalName(id);
- if (name === null) {
- if (id === _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_11__.LanguageDefinedFunction.getMainFunctionName()) {
- return null;
- }
- return id;
- } else {
- return name;
- }
- }
- }, {
- key: "parseFunctionCallExpression",
- value: function parseFunctionCallExpression(id) {
- var stepBack = id.indexOf(".") === -1 ? 1 : 3;
- var tokenA = this.getToken(this.pos - stepBack);
- var actualParameters = this.parseActualParameters();
- var tokenB = this.getToken(this.pos - 1);
- var funcName = this.getFunctionName(id);
- var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfoFromList(tokenA, tokenB);
- var cmd = new _expressions__WEBPACK_IMPORTED_MODULE_3__.FunctionCall(funcName, actualParameters);
- cmd.sourceInfo = sourceInfo;
- return cmd;
- }
- }, {
- key: "parseFunctionCallCommand",
- value: function parseFunctionCallCommand(id) {
- return this.parseFunctionCallExpression(id);
- }
- }, {
- key: "parseParenthesisExp",
- value: function parseParenthesisExp() {
- this.checkOpenParenthesis();
- var tokenA = this.getToken();
- this.consumeNewLines();
- var exp = this.parseExpressionOR();
- this.consumeNewLines();
- this.checkCloseParenthesis();
- var tokenB = this.getToken();
- this.pos += 1;
- exp.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfoFromList(tokenA, tokenB);
- exp.parenthesis = true;
- return exp;
- }
- }, {
- key: "parseActualParameters",
- value: function parseActualParameters() {
- this.checkOpenParenthesis();
- this.pos++;
- if (this.checkCloseParenthesis(true)) {
- this.pos++;
- return [];
- }
- this.consumeNewLines();
- var list = this.parseExpressionList();
- this.consumeNewLines();
- this.checkCloseParenthesis();
- this.pos++;
- return list;
- }
- }, {
- key: "parseExpressionList",
- value: function parseExpressionList() {
- var list = [];
- for (;;) {
- var exp = this.parseExpressionOR();
- list.push(exp);
- var maybeToken = this.getToken();
- if (maybeToken.type !== this.ruleNames.COMMA) {
- break;
- } else {
- this.pos++;
- this.consumeNewLines();
- }
- }
- return list;
- }
- }, {
- key: "getTypeArray",
- value: function getTypeArray() {
- var _this2 = this;
- var types = this.insideScope(IVProgParser.FUNCTION) ? this.functionTypes : this.variableTypes;
- return types.map(function (x) {
- return _this2.lexer.literalNames[x];
- });
- }
- }]);
- return IVProgParser;
- }();
- /***/ }),
- /***/ "./js/ast/sourceInfo.js":
- /*!******************************!*\
- !*** ./js/ast/sourceInfo.js ***!
- \******************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "SourceInfo": () => (/* binding */ SourceInfo)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
- var SourceInfo = /*#__PURE__*/function () {
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(SourceInfo, null, [{
- key: "createSourceInfo",
- /**
- * @param {moo.Token} token
- *
- * @return {SourceInfo}
- * **/
- value: function createSourceInfo(token) {
- return new SourceInfo(token.line, token.col, token.text, token.text.length);
- }
- /**
- * @param {moo.Token} tokenA
- * @param {moo.Token} tokenB
- *
- * @return {SourceInfo}
- * **/
- }, {
- key: "createSourceInfoFromList",
- value: function createSourceInfoFromList(tokenA, tokenB) {
- var line = tokenA.line;
- 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
- // No idea why...
- var size = tokenB.offset + 1 - tokenA.offset;
- return new SourceInfo(line, column, "", size);
- }
- /**
- * @param {number} line
- * @param {number} column
- * @param {string} text
- * @param {number} size
- * **/
- }]);
- function SourceInfo(line, column, text, size) {
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, SourceInfo);
- this.line = line;
- this.column = column;
- this.text = text;
- this.size = size;
- }
- return SourceInfo;
- }();
- /***/ }),
- /***/ "./js/io/domConsole.js":
- /*!*****************************!*\
- !*** ./js/io/domConsole.js ***!
- \*****************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "DOMConsole": () => (/* binding */ DOMConsole)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js");
- /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js");
- /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__);
- /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
- /* harmony import */ var _util_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./../util/utils */ "./js/util/utils.js");
- /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./../util/config */ "./js/util/config.ts");
- var DOMConsole = /*#__PURE__*/function () {
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default()(DOMConsole, null, [{
- key: "BASH_TEMPLATE",
- get: function get() {
- 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>";
- }
- }, {
- key: "INPUT_CARET_TEMPLATE",
- get: function get() {
- return "\n <div id=\"cmd\">\n <span></span>\n <div id=\"cursor\"></div>\n </div>";
- }
- }, {
- key: "USER",
- get: function get() {
- return 0;
- }
- }, {
- key: "INFO",
- get: function get() {
- return 1;
- }
- }, {
- key: "ERR",
- get: function get() {
- return 2;
- }
- }, {
- key: "INPUT",
- get: function get() {
- return 3;
- }
- }]);
- function DOMConsole(elementID) {
- var disableMarginTop = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default()(this, DOMConsole);
- this.disableMarginTop = disableMarginTop;
- this.input = null;
- this.cursorInterval = null;
- this.idleInterval = null;
- this.inputDiv = null;
- this.inputCMD = null;
- this.inputSpan = null;
- this.cursorRef = null;
- this.needInput = false;
- this.clearBtn = null;
- this.hideBtn = null;
- this.showBtn = null;
- this.termDiv = null;
- this.anyKey = false;
- var actualID = elementID;
- if (elementID[0] === "#") {
- actualID = elementID.substring(1);
- }
- this.parent = document.getElementById(actualID);
- this.setup();
- this.inputListeners = [];
- this.hideInput();
- this.pending_writes = [];
- this.last_clear = -1;
- }
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default()(DOMConsole, [{
- key: "setup",
- value: function setup() {
- this._setupDom();
- this._setupEvents();
- }
- }, {
- key: "_setupEvents",
- value: function _setupEvents() {
- this.input.addEventListener("keydown", this.registerInput.bind(this));
- this.clearBtn.addEventListener("click", this.clearBtnClick.bind(this));
- this.hideBtn.addEventListener("click", this.hideBtnClick.bind(this));
- this.showBtn.addEventListener("click", this.showBtnClick.bind(this));
- }
- }, {
- key: "registerInput",
- value: function registerInput(event) {
- if (!this.needInput) {
- return;
- }
- var keyCode = event.which;
- if (keyCode === 13 || this.anyKey) {
- if (this.idleInterval != null) {
- clearInterval(this.idleInterval);
- this.idleInterval = null;
- }
- var text = this.input.value;
- text = text.replace("[\n\r]+", "");
- this.notifyListeners(text);
- this._appendUserInput(text);
- this.input.value = "";
- this.inputSpan.innerHTML = "";
- this.currentLine = null;
- }
- }
- }, {
- key: "_setupDom",
- value: function _setupDom() {
- var bashNode = document.createElement("div");
- bashNode.classList.add("bash");
- bashNode.innerHTML = DOMConsole.BASH_TEMPLATE;
- this.termDiv = bashNode.querySelector("#ivprog-term");
- this.termDiv.classList.add("ivprog-term-div");
- this.inputDiv = document.createElement("div");
- this.inputDiv.id = "ivprog-terminal-inputdiv";
- this.inputDiv.innerHTML = DOMConsole.INPUT_CARET_TEMPLATE;
- this.input = document.createElement("input");
- this.input.setAttribute("name", "command");
- this.input.setAttribute("value", "");
- this.input.setAttribute("type", "text");
- this.input.setAttribute("autocomplete", "off");
- this.inputDiv.append(this.input);
- this.termDiv.append(this.inputDiv);
- bashNode.append(this.termDiv);
- this.parent.append(bashNode);
- this.inputCMD = this.inputDiv.querySelector("#cmd");
- this.cursorRef = this.inputCMD.querySelector("#cursor");
- this.inputSpan = this.inputCMD.querySelector("span");
- this.clearBtn = bashNode.querySelector("#ivprog-console-clearbtn");
- this.hideBtn = bashNode.querySelector("#ivprog-console-hidebtn");
- this.showBtn = bashNode.querySelector("#ivprog-console-showbtn");
- this._setupCursor(); //Jquery tooltips....
- window.$(this.clearBtn).popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_4__.LocalizedStrings.getUI("tooltip_terminal_clear")
- });
- window.$(this.showBtn).popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_4__.LocalizedStrings.getUI("tooltip_terminal_show")
- });
- window.$(this.hideBtn).popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_4__.LocalizedStrings.getUI("tooltip_terminal_hide")
- });
- }
- }, {
- key: "_setupCursor",
- value: function _setupCursor() {
- this.inputCMD.addEventListener("click", this.blinkCaretAndFocus.bind(this)); //this.inputCMD.click();
- this.input.addEventListener("keyup", this.updateSpanText.bind(this));
- this.input.addEventListener("blur", this.stopBlinkCaret.bind(this));
- }
- }, {
- key: "blinkCaretAndFocus",
- value: function blinkCaretAndFocus() {
- var _this = this;
- if (this.cursorInterval != null) {
- return;
- }
- this.input.focus();
- this.cursorInterval = window.setInterval(function () {
- if (_this.cursorRef.style.visibility === "visible") {
- _this.cursorRef.style.visibility = "hidden";
- } else {
- _this.cursorRef.style.visibility = "visible";
- }
- }, 500);
- }
- }, {
- key: "updateSpanText",
- value: function updateSpanText() {
- this.inputSpan.innerHTML = this.input.value;
- if (this.idleInterval != null) window.clearInterval(this.idleInterval);
- this.scheduleNotify();
- }
- }, {
- key: "stopBlinkCaret",
- value: function stopBlinkCaret() {
- clearInterval(this.cursorInterval);
- this.cursorInterval = null;
- this.cursorRef.style.visibility = "visible";
- }
- }, {
- key: "notifyListeners",
- value: function notifyListeners(text) {
- this.inputListeners.forEach(function (resolve) {
- return resolve(text);
- });
- this.inputListeners.splice(0, this.inputListeners.length);
- this.hideInput();
- this.anyKey = false;
- }
- }, {
- key: "writeRawHTML",
- value: function writeRawHTML(text, channel) {
- this._appendTextLn(text, channel, false);
- }
- }, {
- key: "write",
- value: function write(text) {
- var newLine = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- this._appendText(text, DOMConsole.USER, newLine);
- }
- }, {
- key: "info",
- value: function info(text) {
- this._appendTextLn(text, DOMConsole.INFO);
- }
- }, {
- key: "err",
- value: function err(text) {
- this._appendTextLn(text, DOMConsole.ERR);
- }
- }, {
- key: "_appendText",
- value: function () {
- 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) {
- var newLine,
- write_time,
- divClass,
- textDiv,
- _args = arguments;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- newLine = _args.length > 2 && _args[2] !== undefined ? _args[2] : false;
- // console.debug("Caling appendText");
- write_time = Date.now();
- this.pending_writes.push(0);
- _context.next = 5;
- return _util_utils__WEBPACK_IMPORTED_MODULE_5__.sleep(3);
- case 5:
- this.pending_writes.pop();
- if (!(this.last_clear >= write_time)) {
- _context.next = 8;
- break;
- }
- return _context.abrupt("return");
- case 8:
- if (this.currentLine == null) {
- divClass = this.getClassForType(type);
- textDiv = document.createElement("div");
- textDiv.classList.add(divClass);
- this.termDiv.insertBefore(textDiv, this.inputDiv);
- this.currentLine = textDiv;
- }
- this.currentLine.innerHTML += this.getOutputText(text);
- if (newLine) {
- // console.debug("append newline");
- this.currentLine = null;
- }
- this.scrollTerm();
- case 12:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- function _appendText(_x, _x2) {
- return _appendText2.apply(this, arguments);
- }
- return _appendText;
- }()
- }, {
- key: "_appendTextLn",
- value: function () {
- 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) {
- var filter,
- write_time,
- divClass,
- textDiv,
- _args2 = arguments;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee2$(_context2) {
- while (1) {
- switch (_context2.prev = _context2.next) {
- case 0:
- filter = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : true;
- write_time = Date.now();
- this.pending_writes.push(0);
- _context2.next = 5;
- return _util_utils__WEBPACK_IMPORTED_MODULE_5__.sleep(3);
- case 5:
- this.pending_writes.pop();
- if (!(this.last_clear >= write_time)) {
- _context2.next = 8;
- break;
- }
- return _context2.abrupt("return");
- case 8:
- divClass = this.getClassForType(type);
- textDiv = document.createElement("div");
- textDiv.classList.add(divClass);
- if (filter) textDiv.innerHTML = this.getOutputText(text);else textDiv.innerHTML = "<span>".concat(text, "</span>");
- if (this.currentLine != null && this.currentLine.innerHTML.length === 0) {
- this.termDiv.removeChild(this.currentLine);
- }
- this.termDiv.insertBefore(textDiv, this.inputDiv);
- this.currentLine = null;
- this.scrollTerm();
- case 16:
- case "end":
- return _context2.stop();
- }
- }
- }, _callee2, this);
- }));
- function _appendTextLn(_x3, _x4) {
- return _appendTextLn2.apply(this, arguments);
- }
- return _appendTextLn;
- }()
- }, {
- key: "_appendUserInput",
- value: function () {
- var _appendUserInput2 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee3(text) {
- var write_time, divClass, textDiv;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee3$(_context3) {
- while (1) {
- switch (_context3.prev = _context3.next) {
- case 0:
- write_time = Date.now();
- this.pending_writes.push(0);
- _context3.next = 4;
- return _util_utils__WEBPACK_IMPORTED_MODULE_5__.sleep(3);
- case 4:
- this.pending_writes.pop();
- if (!(this.last_clear >= write_time)) {
- _context3.next = 7;
- break;
- }
- return _context3.abrupt("return");
- case 7:
- divClass = this.getClassForType(DOMConsole.INPUT);
- textDiv = document.createElement("div");
- textDiv.innerHTML = this.getUserInputText(text);
- textDiv.classList.add(divClass);
- this.termDiv.insertBefore(textDiv, this.inputDiv);
- this.currentLine = null;
- this.scrollTerm();
- case 14:
- case "end":
- return _context3.stop();
- }
- }
- }, _callee3, this);
- }));
- function _appendUserInput(_x5) {
- return _appendUserInput2.apply(this, arguments);
- }
- return _appendUserInput;
- }()
- }, {
- key: "getOutputText",
- value: function getOutputText(text) {
- text = text.replace(/\s/g, " ");
- return "<span>".concat(text, "</span>");
- }
- }, {
- key: "getUserInputText",
- value: function getUserInputText(text) {
- if (text.trim().length == 0) {
- text = " ";
- }
- return "<i class=\"icon keyboard outline\" style=\"float:left\"></i><span>".concat(text, "</span>");
- }
- }, {
- key: "scrollTerm",
- value: function scrollTerm() {
- //scrollIt(this.inputDiv.previousSibling,200);
- this.termDiv.scrollTop = this.termDiv.scrollHeight;
- }
- }, {
- key: "focus",
- value: function focus() {
- this.termDiv.style.display = "block"; // Is in draggable mode?
- if (!this.disableMarginTop && this.parent.style.top.length == 0) {
- this.parent.style.marginTop = "-160px";
- }
- if (this.needInput) {
- this.showInput();
- this.scheduleNotify();
- }
- if (!_util_utils__WEBPACK_IMPORTED_MODULE_5__.isElementInViewport(this.termDiv)) this.termDiv.scrollIntoView(false);
- this.scrollTerm();
- }
- }, {
- key: "hide",
- value: function hide() {
- if (this.needInput) {
- clearInterval(this.idleInterval);
- this.hideInput();
- this.needInput = true;
- } // Is in draggable mode?
- if (!this.disableMarginTop && this.parent.style.top.length == 0) {
- this.parent.style.marginTop = "0";
- }
- this.termDiv.style.display = "none";
- }
- }, {
- key: "getClassForType",
- value: function getClassForType(type) {
- switch (type) {
- case DOMConsole.INPUT:
- return "ivprog-term-userInput";
- case DOMConsole.USER:
- return "ivprog-term-userText";
- case DOMConsole.INFO:
- return "ivprog-term-info";
- case DOMConsole.ERR:
- return "ivprog-term-error";
- }
- }
- }, {
- key: "dispose",
- value: function dispose() {
- this.input.removeEventListener("keyup", this.updateSpanText.bind(this));
- this.input.removeEventListener("blur", this.stopBlinkCaret.bind(this));
- this.input.removeEventListener("keydown", this.registerInput.bind(this));
- this.inputCMD.removeEventListener("click", this.blinkCaretAndFocus.bind(this));
- this.clearBtn.removeEventListener("click", this.clearBtnClick.bind(this));
- this.hideBtn.removeEventListener("click", this.hideBtnClick.bind(this));
- this.showBtn.removeEventListener("click", this.showBtnClick.bind(this));
- this.input = null;
- this.inputCMD = null;
- this.inputDiv = null;
- this.termDiv = null;
- this.inputSpan = null;
- this.cursorRef = null;
- this.clearBtn = null;
- this.hideBtn = null;
- this.showBtn = null;
- this.currentLine = null;
- var cNode = this.parent.cloneNode(false);
- this.parent.parentNode.replaceChild(cNode, this.parent);
- if (this.cursorInterval != null) {
- clearInterval(this.cursorInterval);
- }
- if (this.idleInterval != null) {
- clearInterval(this.idleInterval);
- }
- }
- }, {
- key: "showInput",
- value: function showInput() {
- this.needInput = true;
- this.inputDiv.style.display = "block";
- this.inputCMD.click(); //this.inputCMD.scrollIntoView();
- this.scrollTerm();
- }
- }, {
- key: "hideInput",
- value: function hideInput() {
- this.needInput = false;
- this.inputDiv.style.display = " none";
- clearInterval(this.cursorInterval);
- this.cursorInterval = null;
- }
- }, {
- key: "requestInput",
- value: function requestInput() {
- var _this2 = this;
- var anyKey = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
- var promise = new Promise(function (resolve, _) {
- _this2.inputListeners.push(resolve);
- _this2.anyKey = anyKey;
- if (_this2.idleInterval == null) _this2.scheduleNotify();
- _this2.showInput();
- });
- return promise;
- }
- }, {
- key: "sendOutput",
- value: function sendOutput(text) {
- //console.debug(text);
- var output = "" + text;
- if (output.indexOf("\n") !== -1) {
- //console.debug("newline");
- var outputList = output.split("\n");
- var i = 0;
- for (; i < outputList.length - 1; i += 1) {
- //console.debug("newline write");
- var _t = outputList[i];
- _t = _t.replace(/\t/g, "  ");
- _t = _t.replace(/\s/g, " ");
- if (_t.length !== 0) {
- this.write(_t);
- }
- this.write("", true);
- }
- var t = outputList[i];
- t = t.replace(/\t/g, "  ");
- t = t.replace(/\s/g, " ");
- if (t.length != 0) this.write(t);
- } else {
- // console.debug("no newline");
- output = output.replace(/\t/g, "  ");
- output = output.replace(/\s/g, " ");
- if (output.length != 0) this.write(output);
- }
- }
- }, {
- key: "clearPendingWrites",
- value: function clearPendingWrites() {
- this.last_clear = Date.now();
- }
- }, {
- key: "clear",
- value: function clear() {
- this.clearPendingWrites();
- while (this.inputDiv.parentElement.childNodes.length > 1) {
- this.inputDiv.parentElement.removeChild(this.inputDiv.parentElement.firstChild);
- }
- this.input.value = "";
- this.inputSpan.innerHTML = "";
- this.currentLine = null;
- }
- }, {
- key: "clearBtnClick",
- value: function clearBtnClick() {
- this.clear();
- }
- }, {
- key: "showBtnClick",
- value: function showBtnClick() {
- this.focus();
- }
- }, {
- key: "hideBtnClick",
- value: function hideBtnClick() {
- this.hide();
- }
- }, {
- key: "notifyIdle",
- value: function notifyIdle() {
- this.info(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_4__.LocalizedStrings.getMessage("awaiting_input_message"));
- this.inputCMD.click();
- }
- }, {
- key: "scheduleNotify",
- value: function scheduleNotify() {
- this.idleInterval = window.setInterval(this.notifyIdle.bind(this), _util_config__WEBPACK_IMPORTED_MODULE_6__.Config.idle_input_interval);
- }
- }, {
- key: "cancelPendingInputRequests",
- value: function cancelPendingInputRequests() {
- this.inputListeners.forEach(function (resolve) {
- return resolve("");
- });
- this.inputListeners.splice(0, this.inputListeners.length);
- if (this.idleInterval != null) {
- clearInterval(this.idleInterval);
- this.idleInterval = null;
- }
- this.input.value = "";
- this.inputSpan.innerHTML = "";
- this.currentLine = null;
- this.hideInput();
- this.anyKey = false;
- }
- }]);
- return DOMConsole;
- }();
- /***/ }),
- /***/ "./js/io/input.js":
- /*!************************!*\
- !*** ./js/io/input.js ***!
- \************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "Input": () => (/* binding */ Input)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
- var Input = /*#__PURE__*/function () {
- function Input() {
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, Input);
- }
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(Input, [{
- key: "requestInput",
- value: function requestInput() {
- throw new Error("Must be implemented");
- }
- }, {
- key: "cancelPendingInputRequests",
- value: function cancelPendingInputRequests() {
- throw new Error("Must be implemented");
- }
- }]);
- return Input;
- }();
- /***/ }),
- /***/ "./js/io/output.js":
- /*!*************************!*\
- !*** ./js/io/output.js ***!
- \*************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "Output": () => (/* binding */ Output)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
- var Output = /*#__PURE__*/function () {
- function Output() {
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, Output);
- }
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(Output, [{
- key: "sendOutput",
- value: function sendOutput(text) {
- throw new Error("Must be implemented");
- }
- }]);
- return Output;
- }();
- /***/ }),
- /***/ "./js/main.js":
- /*!********************!*\
- !*** ./js/main.js ***!
- \********************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "runner": () => (/* reexport safe */ _runner__WEBPACK_IMPORTED_MODULE_0__.runner),
- /* harmony export */ "initVisualUI": () => (/* reexport safe */ _visualUI_functions__WEBPACK_IMPORTED_MODULE_1__.initVisualUI),
- /* harmony export */ "addFunctionChangeListener": () => (/* reexport safe */ _visualUI_functions__WEBPACK_IMPORTED_MODULE_1__.addFunctionChangeListener),
- /* harmony export */ "addGlobalChangeListener": () => (/* reexport safe */ _visualUI_functions__WEBPACK_IMPORTED_MODULE_1__.addGlobalChangeListener),
- /* harmony export */ "removeFunctionListener": () => (/* reexport safe */ _visualUI_functions__WEBPACK_IMPORTED_MODULE_1__.removeFunctionListener),
- /* harmony export */ "removeGlobalListener": () => (/* reexport safe */ _visualUI_functions__WEBPACK_IMPORTED_MODULE_1__.removeGlobalListener),
- /* harmony export */ "getTestCases": () => (/* reexport safe */ _visualUI_functions__WEBPACK_IMPORTED_MODULE_1__.getTestCases),
- /* harmony export */ "autoEval": () => (/* reexport safe */ _util_iassignHelpers__WEBPACK_IMPORTED_MODULE_5__.autoEval),
- /* harmony export */ "prepareActivityToStudentHelper": () => (/* reexport safe */ _util_iassignHelpers__WEBPACK_IMPORTED_MODULE_5__.prepareActivityToStudentHelper),
- /* harmony export */ "prepareActivityToStudentHelperJSON": () => (/* reexport safe */ _util_iassignHelpers__WEBPACK_IMPORTED_MODULE_5__.prepareActivityToStudentHelperJSON),
- /* harmony export */ "LocalizedStrings": () => (/* binding */ LocalizedStrings),
- /* harmony export */ "i18n": () => (/* binding */ i18n),
- /* harmony export */ "getLogs": () => (/* reexport safe */ _services_userLog__WEBPACK_IMPORTED_MODULE_4__.getLogs),
- /* harmony export */ "getLogsAsString": () => (/* reexport safe */ _services_userLog__WEBPACK_IMPORTED_MODULE_4__.getLogsAsString),
- /* harmony export */ "registerClick": () => (/* reexport safe */ _services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerClick),
- /* harmony export */ "registerUserEvent": () => (/* reexport safe */ _services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent),
- /* harmony export */ "parseLogs": () => (/* reexport safe */ _services_userLog__WEBPACK_IMPORTED_MODULE_4__.parseLogs),
- /* harmony export */ "ActionTypes": () => (/* reexport safe */ _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes),
- /* harmony export */ "CodeEditor": () => (/* binding */ CodeEditor),
- /* harmony export */ "openAssessmentDetail": () => (/* reexport safe */ _util_utils__WEBPACK_IMPORTED_MODULE_6__.openAssessmentDetail),
- /* harmony export */ "autoGenerateTestCaseOutput": () => (/* reexport safe */ _util_auto_gen_output__WEBPACK_IMPORTED_MODULE_11__.autoGenerateTestCaseOutput),
- /* harmony export */ "Config": () => (/* reexport safe */ _util_config__WEBPACK_IMPORTED_MODULE_7__.Config),
- /* harmony export */ "parseExpression": () => (/* reexport safe */ _util_parseFromVisual__WEBPACK_IMPORTED_MODULE_9__.parseExpression),
- /* harmony export */ "parseCode": () => (/* reexport safe */ _util_parseFromVisual__WEBPACK_IMPORTED_MODULE_9__.parseCode),
- /* harmony export */ "generateCode": () => (/* reexport safe */ _visualUI_code_generator__WEBPACK_IMPORTED_MODULE_12__.generate),
- /* harmony export */ "levenshteinDistance": () => (/* reexport safe */ _util_utils__WEBPACK_IMPORTED_MODULE_6__.levenshteinDistance),
- /* harmony export */ "processData": () => (/* reexport safe */ _util_dataProcess__WEBPACK_IMPORTED_MODULE_8__.processData),
- /* harmony export */ "Settings": () => (/* binding */ Settings),
- /* harmony export */ "setPreviousAlgorithm": () => (/* reexport safe */ _util_iassignHelpers__WEBPACK_IMPORTED_MODULE_5__.setPreviousAlgorithm)
- /* harmony export */ });
- /* harmony import */ var _runner__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./runner */ "./js/runner.js");
- /* harmony import */ var _visualUI_functions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./visualUI/functions */ "./js/visualUI/functions.js");
- /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./services/localizedStringsService */ "./js/services/localizedStringsService.js");
- /* harmony import */ var _services_i18nHelper__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./services/i18nHelper */ "./js/services/i18nHelper.js");
- /* harmony import */ var _services_userLog__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./services/userLog */ "./js/services/userLog.js");
- /* harmony import */ var _util_iassignHelpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./util/iassignHelpers */ "./js/util/iassignHelpers.js");
- /* harmony import */ var _util_utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./util/utils */ "./js/util/utils.js");
- /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./util/config */ "./js/util/config.ts");
- /* harmony import */ var _util_dataProcess__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./util/dataProcess */ "./js/util/dataProcess.js");
- /* harmony import */ var _util_parseFromVisual__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./util/parseFromVisual */ "./js/util/parseFromVisual.js");
- /* harmony import */ var _visualUI_text_editor__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./visualUI/text_editor */ "./js/visualUI/text_editor.js");
- /* harmony import */ var _util_auto_gen_output__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./util/auto_gen_output */ "./js/util/auto_gen_output.js");
- /* harmony import */ var _visualUI_code_generator__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./visualUI/code_generator */ "./js/visualUI/code_generator.js");
- var CodeEditor = {
- initTextEditor: _visualUI_text_editor__WEBPACK_IMPORTED_MODULE_10__.initTextEditor,
- setCode: _visualUI_text_editor__WEBPACK_IMPORTED_MODULE_10__.setCode,
- getCode: _visualUI_text_editor__WEBPACK_IMPORTED_MODULE_10__.getCode,
- updateEditor: _visualUI_text_editor__WEBPACK_IMPORTED_MODULE_10__.updateEditor,
- disable: _visualUI_text_editor__WEBPACK_IMPORTED_MODULE_10__.disable
- };
- var Settings = {
- programming: [],
- functions: [],
- datatypes: [],
- commands: [],
- filter: []
- };
- var i18n = _services_i18nHelper__WEBPACK_IMPORTED_MODULE_3__.i18nHelper.i18n;
- var LocalizedStrings = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.getInstance();
- /***/ }),
- /***/ "./js/processor/definedFunctions.js":
- /*!******************************************!*\
- !*** ./js/processor/definedFunctions.js ***!
- \******************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "LanguageDefinedFunction": () => (/* binding */ LanguageDefinedFunction)
- /* harmony export */ });
- /* harmony import */ var _services_languageService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.ts");
- /* harmony import */ var _lib_io__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./lib/io */ "./js/processor/lib/io.js");
- /* harmony import */ var _lib_strings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./lib/strings */ "./js/processor/lib/strings.js");
- /* harmony import */ var _lib_arrays__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./lib/arrays */ "./js/processor/lib/arrays.js");
- /* harmony import */ var _lib_lang__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./lib/lang */ "./js/processor/lib/lang.js");
- /* harmony import */ var _lib_math__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./lib/math */ "./js/processor/lib/math.js");
- function valueToKey(value, object) {
- for (var key in object) {
- if (Object.prototype.hasOwnProperty.call(object, key)) {
- if (object[key] === value) {
- return key;
- }
- }
- }
- return null;
- }
- function concatObjects() {
- var result = {};
- for (var i = 0; i < arguments.length; i++) {
- var obj = i < 0 || arguments.length <= i ? undefined : arguments[i];
- for (var key in obj) {
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
- result[key] = obj[key];
- }
- }
- }
- return result;
- }
- var libsObject = {
- $mathLib: {
- $sin: (0,_lib_math__WEBPACK_IMPORTED_MODULE_5__.createSinFun)(),
- $cos: (0,_lib_math__WEBPACK_IMPORTED_MODULE_5__.createCosFun)(),
- $tan: (0,_lib_math__WEBPACK_IMPORTED_MODULE_5__.createTanFun)(),
- $sqrt: (0,_lib_math__WEBPACK_IMPORTED_MODULE_5__.createSqrtFun)(),
- $pow: (0,_lib_math__WEBPACK_IMPORTED_MODULE_5__.createPowFun)(),
- $log: (0,_lib_math__WEBPACK_IMPORTED_MODULE_5__.createLogFun)(),
- $abs: (0,_lib_math__WEBPACK_IMPORTED_MODULE_5__.createAbsFun)(),
- $negate: (0,_lib_math__WEBPACK_IMPORTED_MODULE_5__.createNegateFun)(),
- $invert: (0,_lib_math__WEBPACK_IMPORTED_MODULE_5__.createInvertFun)(),
- $max: (0,_lib_math__WEBPACK_IMPORTED_MODULE_5__.createMaxFun)(),
- $min: (0,_lib_math__WEBPACK_IMPORTED_MODULE_5__.createMinFun)(),
- $rand: (0,_lib_math__WEBPACK_IMPORTED_MODULE_5__.createRandFun)()
- },
- $ioLib: {
- $read: (0,_lib_io__WEBPACK_IMPORTED_MODULE_1__.createInputFun)(),
- $write: (0,_lib_io__WEBPACK_IMPORTED_MODULE_1__.createOutputFun)()
- },
- $strLib: {
- $substring: (0,_lib_strings__WEBPACK_IMPORTED_MODULE_2__.createSubstringFun)(),
- $length: (0,_lib_strings__WEBPACK_IMPORTED_MODULE_2__.createLengthFun)(),
- $uppercase: (0,_lib_strings__WEBPACK_IMPORTED_MODULE_2__.createUppercaseFun)(),
- $lowercase: (0,_lib_strings__WEBPACK_IMPORTED_MODULE_2__.createLowercaseFun)(),
- $charAt: (0,_lib_strings__WEBPACK_IMPORTED_MODULE_2__.createrCharAtFun)()
- },
- $arrayLib: {
- $numElements: (0,_lib_arrays__WEBPACK_IMPORTED_MODULE_3__.createNumElementsFun)(),
- $matrixLines: (0,_lib_arrays__WEBPACK_IMPORTED_MODULE_3__.createMatrixLinesFun)(),
- $matrixColumns: (0,_lib_arrays__WEBPACK_IMPORTED_MODULE_3__.createMatrixColumnsFun)()
- },
- $langLib: {
- $isReal: (0,_lib_lang__WEBPACK_IMPORTED_MODULE_4__.createIsRealFun)(),
- $isInt: (0,_lib_lang__WEBPACK_IMPORTED_MODULE_4__.createIsIntFun)(),
- $isBool: (0,_lib_lang__WEBPACK_IMPORTED_MODULE_4__.createIsBoolFun)(),
- $castReal: (0,_lib_lang__WEBPACK_IMPORTED_MODULE_4__.createCastRealFun)(),
- $castInt: (0,_lib_lang__WEBPACK_IMPORTED_MODULE_4__.createCastIntFun)(),
- $castBool: (0,_lib_lang__WEBPACK_IMPORTED_MODULE_4__.createCastBoolFun)(),
- $castString: (0,_lib_lang__WEBPACK_IMPORTED_MODULE_4__.createCastStringFun)(),
- $castChar: (0,_lib_lang__WEBPACK_IMPORTED_MODULE_4__.createCastCharFun)()
- }
- };
- var funcsObject = concatObjects(libsObject.$ioLib, libsObject.$langLib, libsObject.$strLib, libsObject.$arrayLib);
- var LanguageDefinedFunction = Object.freeze({
- getMainFunctionName: function getMainFunctionName() {
- return _services_languageService__WEBPACK_IMPORTED_MODULE_0__.LanguageService.getCurrentLangFuncs().main_function;
- },
- getInternalName: function getInternalName(localName) {
- if (localName.indexOf(".") !== -1) {
- var names = localName.split(".");
- var lib = valueToKey(names[0], _services_languageService__WEBPACK_IMPORTED_MODULE_0__.LanguageService.getCurrentLangLibs());
- var internalName = valueToKey(names[1], _services_languageService__WEBPACK_IMPORTED_MODULE_0__.LanguageService.getCurrentLangFuncs());
- if (lib === null || internalName === null) {
- return null;
- }
- return lib + "." + internalName;
- }
- var funcName = valueToKey(localName, _services_languageService__WEBPACK_IMPORTED_MODULE_0__.LanguageService.getCurrentLangFuncs());
- if (funcName !== null) {
- if (funcsObject[funcName]) {
- return funcName;
- }
- }
- return null;
- },
- getFunction: function getFunction(internalName) {
- if (internalName.indexOf(".") !== -1) {
- var names = internalName.split(".");
- var libName = names[0];
- var funName = names[1];
- return libsObject[libName][funName];
- }
- return funcsObject[internalName];
- },
- getLocalName: function getLocalName(internalName) {
- if (internalName.indexOf(".") !== -1) {
- var names = internalName.split(".");
- var libName = _services_languageService__WEBPACK_IMPORTED_MODULE_0__.LanguageService.getCurrentLangLibs()[names[0]];
- var funName = _services_languageService__WEBPACK_IMPORTED_MODULE_0__.LanguageService.getCurrentLangFuncs()[names[1]];
- return "".concat(libName, ".").concat(funName);
- } else if (_services_languageService__WEBPACK_IMPORTED_MODULE_0__.LanguageService.getCurrentLangFuncs()[internalName]) {
- return _services_languageService__WEBPACK_IMPORTED_MODULE_0__.LanguageService.getCurrentLangFuncs()[internalName];
- } else {
- return internalName;
- }
- }
- });
- /***/ }),
- /***/ "./js/processor/error/processorErrorFactory.js":
- /*!*****************************************************!*\
- !*** ./js/processor/error/processorErrorFactory.js ***!
- \*****************************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "ProcessorErrorFactory": () => (/* binding */ ProcessorErrorFactory)
- /* harmony export */ });
- /* harmony import */ var _runtimeError__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./runtimeError */ "./js/processor/error/runtimeError.js");
- /* harmony import */ var _semanticError__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./semanticError */ "./js/processor/error/semanticError.js");
- /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
- /* harmony import */ var _definedFunctions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../definedFunctions */ "./js/processor/definedFunctions.js");
- var LocalizedStrings = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.getInstance();
- function createRuntimeError(i18n_id) {
- var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
- return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__.RuntimeError(LocalizedStrings.getError(i18n_id, context), i18n_id);
- }
- function createSemanticError(i18n_id) {
- var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
- return new _semanticError__WEBPACK_IMPORTED_MODULE_1__.SemanticError(LocalizedStrings.getError(i18n_id, context), i18n_id);
- }
- var ProcessorErrorFactory = Object.freeze({
- symbol_not_found_full: function symbol_not_found_full(id, sourceInfo) {
- if (sourceInfo) {
- var context = [id, sourceInfo.line, sourceInfo.column];
- var error = createSemanticError("symbol_not_found_full", context);
- error.context = {
- line: sourceInfo.line,
- column: sourceInfo.column
- };
- return error;
- } else {
- return ProcessorErrorFactory.symbol_not_found(id);
- }
- },
- symbol_not_found: function symbol_not_found(id) {
- var context = [id];
- return createSemanticError("symbol_not_found", context);
- },
- function_missing_full: function function_missing_full(id, sourceInfo) {
- if (sourceInfo) {
- var context = [id, sourceInfo.line, sourceInfo.column];
- var error = createSemanticError("function_missing_full", context);
- error.context = {
- line: sourceInfo.line,
- column: sourceInfo.column
- };
- return error;
- } else {
- return ProcessorErrorFactory.function_missing(id);
- }
- },
- function_missing: function function_missing(id) {
- var context = [id];
- return createSemanticError("function_missing", context);
- },
- main_missing: function main_missing() {
- return createSemanticError("main_missing");
- },
- array_dimension_not_int_full: function array_dimension_not_int_full(sourceInfo) {
- if (sourceInfo) {
- var context = [sourceInfo.line];
- var error = createSemanticError("array_dimension_not_int_full", context);
- error.context = {
- line: sourceInfo.line,
- column: sourceInfo.column
- };
- return error;
- } else {
- return ProcessorErrorFactory.array_dimension_not_int();
- }
- },
- array_dimension_not_int: function array_dimension_not_int() {
- return createSemanticError("array_dimension_not_int");
- },
- unknown_command_full: function unknown_command_full(sourceInfo) {
- if (sourceInfo) {
- var context = [sourceInfo.line];
- var error = createRuntimeError("unknown_command_full", context);
- error.context = {
- line: sourceInfo.line,
- column: sourceInfo.column
- };
- return error;
- } else {
- return ProcessorErrorFactory.unknown_command();
- }
- },
- unknown_command: function unknown_command() {
- return createRuntimeError("unknown_command");
- },
- incompatible_types_full: function incompatible_types_full(left_type, left_dim, right_type, right_dim, exp, source_info) {
- if (source_info) {
- var context = [LocalizedStrings.translateType(left_type, left_dim), exp, source_info.line, LocalizedStrings.translateType(right_type, right_dim)];
- var error = createSemanticError("incompatible_types_full", context);
- error.context = {
- line: source_info.line,
- column: source_info.column
- };
- return error;
- } else {
- return ProcessorErrorFactory.incompatible_types(left_type, left_dim, right_type, right_dim, exp);
- }
- },
- incompatible_types: function incompatible_types(left_type, left_dim, right_type, right_dim, exp) {
- var context = [LocalizedStrings.translateType(left_type, left_dim), exp, LocalizedStrings.translateType(right_type, right_dim)];
- return createSemanticError("incompatible_types", context);
- },
- incompatible_types_array_full: function incompatible_types_array_full(exp, type, dim, sourceInfo) {
- if (sourceInfo) {
- var context = [exp, LocalizedStrings.translateType(type, dim), sourceInfo.line, sourceInfo.column];
- var error = createSemanticError("incompatible_types_array_full", context);
- error.context = {
- line: sourceInfo.line,
- column: sourceInfo.column
- };
- return error;
- } else {
- return ProcessorErrorFactory.incompatible_types_array(exp, type, dim);
- }
- },
- incompatible_types_array: function incompatible_types_array(exp, type, dim) {
- var context = [exp, LocalizedStrings.translateType(type, dim)];
- return createSemanticError("incompatible_types_array", context);
- },
- loop_condition_type_full: function loop_condition_type_full(exp, sourceInfo) {
- if (sourceInfo) {
- var context = [sourceInfo.line, sourceInfo.column, exp];
- var error = createSemanticError("loop_condition_type_full", context);
- error.context = {
- line: sourceInfo.line,
- column: sourceInfo.column
- };
- return error;
- } else {
- return ProcessorErrorFactory.loop_condition_type(exp);
- }
- },
- loop_condition_type: function loop_condition_type(exp) {
- var context = [exp];
- return createSemanticError("loop_condition_type", context);
- },
- /**
- * @deprecated 01/10/2019
- */
- endless_loop_full: function endless_loop_full(sourceInfo) {
- if (sourceInfo) {
- var context = [sourceInfo.line];
- var error = createSemanticError("endless_loop_full", context);
- error.context = {
- line: sourceInfo.line,
- column: sourceInfo.column
- };
- return error;
- } else {
- return ProcessorErrorFactory.endless_loop();
- }
- },
- endless_loop: function endless_loop() {
- return createSemanticError("endless_loop");
- },
- if_condition_type_full: function if_condition_type_full(exp, sourceInfo) {
- if (sourceInfo) {
- var context = [sourceInfo.line, sourceInfo.column, exp];
- var error = createSemanticError("if_condition_type_full", context);
- error.context = {
- line: sourceInfo.line,
- column: sourceInfo.column
- };
- return error;
- } else {
- return ProcessorErrorFactory.if_condition_type(exp);
- }
- },
- if_condition_type: function if_condition_type(exp) {
- var context = [exp];
- return createSemanticError("if_condition_type", context);
- },
- invalid_global_var: function invalid_global_var() {
- return createRuntimeError("invalid_global_var");
- },
- not_implemented: function not_implemented(id) {
- var context = [id];
- return createRuntimeError("not_implemented", context);
- },
- invalid_case_type_full: function invalid_case_type_full(exp, type, dim, sourceInfo) {
- if (sourceInfo) {
- var context = [exp, LocalizedStrings.translateType(type, dim), sourceInfo.line, sourceInfo.column];
- var error = createSemanticError("invalid_case_type_full", context);
- error.context = {
- line: sourceInfo.line,
- column: sourceInfo.column
- };
- return error;
- } else {
- return ProcessorErrorFactory.invalid_case_type(exp, type, dim);
- }
- },
- invalid_case_type: function invalid_case_type(exp, type, dim) {
- var context = [exp, LocalizedStrings.translateType(type, dim)];
- return createSemanticError("invalid_case_type", context);
- },
- void_in_expression_full: function void_in_expression_full(id, sourceInfo) {
- if (sourceInfo) {
- var context = [sourceInfo.line, sourceInfo.column, id];
- var error = createSemanticError("void_in_expression_full", context);
- error.context = {
- line: sourceInfo.line,
- column: sourceInfo.column
- };
- return error;
- } else {
- return ProcessorErrorFactory.void_in_expression(id);
- }
- },
- void_in_expression: function void_in_expression(id) {
- var context = [id];
- return createSemanticError("void_in_expression", context);
- },
- invalid_array_access_full: function invalid_array_access_full(id, sourceInfo) {
- if (sourceInfo) {
- var context = [id, sourceInfo.line, sourceInfo.column];
- var error = createSemanticError("invalid_array_access_full", context);
- error.context = {
- line: sourceInfo.line,
- column: sourceInfo.column
- };
- return error;
- } else {
- return ProcessorErrorFactory.invalid_array_access(id);
- }
- },
- invalid_array_access: function invalid_array_access(id) {
- var context = [id];
- return createSemanticError("invalid_array_access", context);
- },
- invalid_matrix_access_full: function invalid_matrix_access_full(id, sourceInfo) {
- if (sourceInfo) {
- var context = [id, sourceInfo.line, sourceInfo.column];
- var error = createSemanticError("invalid_matrix_access_full", context);
- error.context = {
- line: sourceInfo.line,
- column: sourceInfo.column
- };
- return error;
- } else {
- return ProcessorErrorFactory.invalid_matrix_access(id);
- }
- },
- invalid_matrix_access: function invalid_matrix_access(id) {
- var context = [id];
- return createSemanticError("invalid_matrix_access", context);
- },
- matrix_column_outbounds_full: function matrix_column_outbounds_full(id, value, columns, sourceInfo) {
- if (sourceInfo) {
- var context = [sourceInfo.line, value, id, columns];
- var error = createRuntimeError("matrix_column_outbounds_full", context);
- error.context = {
- line: sourceInfo.line,
- column: sourceInfo.column
- };
- return error;
- } else {
- return ProcessorErrorFactory.matrix_column_outbounds(id, value, columns);
- }
- },
- matrix_column_outbounds: function matrix_column_outbounds(id, value, columns) {
- var context = [value, id, columns];
- return createRuntimeError("matrix_column_outbounds", context);
- },
- matrix_line_outbounds_full: function matrix_line_outbounds_full(id, value, lines, sourceInfo) {
- if (sourceInfo) {
- var context = [sourceInfo.line, value, id, lines];
- var error = createRuntimeError("matrix_line_outbounds_full", context);
- error.context = {
- line: sourceInfo.line,
- column: sourceInfo.column
- };
- return error;
- } else {
- return ProcessorErrorFactory.matrix_line_outbounds(id, value, lines);
- }
- },
- matrix_line_outbounds: function matrix_line_outbounds(id, value, lines) {
- var context = [value, id, lines];
- return createRuntimeError("matrix_line_outbounds", context);
- },
- vector_line_outbounds_full: function vector_line_outbounds_full(id, value, lines, sourceInfo) {
- if (sourceInfo) {
- var context = [sourceInfo.line, value, id, lines];
- var error = createRuntimeError("vector_line_outbounds_full", context);
- error.context = {
- line: sourceInfo.line,
- column: sourceInfo.column
- };
- return error;
- } else {
- return ProcessorErrorFactory.vector_line_outbounds(id, value, lines);
- }
- },
- vector_line_outbounds: function vector_line_outbounds(id, value, lines) {
- var context = [value, id, lines];
- return createRuntimeError("vector_line_outbounds", context);
- },
- vector_not_matrix_full: function vector_not_matrix_full(id, sourceInfo) {
- if (sourceInfo) {
- var context = [sourceInfo.line, id];
- var error = createRuntimeError("vector_not_matrix_full", context);
- error.context = {
- line: sourceInfo.line,
- column: sourceInfo.column
- };
- return error;
- } else {
- return ProcessorErrorFactory.vector_not_matrix(id);
- }
- },
- vector_not_matrix: function vector_not_matrix(id) {
- var context = [id];
- return createRuntimeError("vector_not_matrix", context);
- },
- function_no_return: function function_no_return(id) {
- var context = [id];
- return createSemanticError("function_no_return", context);
- },
- invalid_void_return_full: function invalid_void_return_full(id, type, dim, sourceInfo) {
- if (sourceInfo) {
- var context = [sourceInfo.line, id, LocalizedStrings.translateType(type, dim)];
- var error = createSemanticError("invalid_void_return_full", context);
- error.context = {
- line: sourceInfo.line,
- column: sourceInfo.column
- };
- return error;
- } else {
- return ProcessorErrorFactory.invalid_void_return(id, type, dim);
- }
- },
- invalid_void_return: function invalid_void_return(id, type, dim) {
- var context = [id, LocalizedStrings.translateType(type, dim)];
- return createSemanticError("invalid_void_return_full", context);
- },
- invalid_return_type_full: function invalid_return_type_full(id, type, dim, sourceInfo) {
- if (sourceInfo) {
- var context = [sourceInfo.line, id, LocalizedStrings.translateType(type, dim)];
- var error = createSemanticError("invalid_return_type_full", context);
- error.context = {
- line: sourceInfo.line,
- column: sourceInfo.column
- };
- return error;
- } else {
- return ProcessorErrorFactory.invalid_return_type(id, type, dim);
- }
- },
- invalid_return_type: function invalid_return_type(id, type, dim) {
- var context = [id, LocalizedStrings.translateType(type, dim)];
- return createSemanticError("invalid_return_type", context);
- },
- invalid_parameters_size_full: function invalid_parameters_size_full(id, expected, actual, sourceInfo) {
- if (sourceInfo) {
- var context = [sourceInfo.line, id, expected, actual];
- var error = createSemanticError("invalid_parameters_size_full", context);
- error.context = {
- line: sourceInfo.line,
- column: sourceInfo.column
- };
- return error;
- } else {
- return ProcessorErrorFactory.invalid_parameters_size(id, expected, actual);
- }
- },
- invalid_parameters_size: function invalid_parameters_size(id, expected, actual) {
- var context = [id, expected, actual];
- return createSemanticError("invalid_parameters_size", context);
- },
- invalid_parameter_type_full: function invalid_parameter_type_full(fun_name, exp, sourceInfo) {
- if (sourceInfo) {
- var context = [exp, _definedFunctions__WEBPACK_IMPORTED_MODULE_3__.LanguageDefinedFunction.getLocalName(fun_name), sourceInfo.line];
- var error = createSemanticError("invalid_parameter_type_full", context);
- error.context = {
- line: sourceInfo.line,
- column: sourceInfo.column
- };
- return error;
- } else {
- return ProcessorErrorFactory.invalid_parameter_type(fun_name, exp);
- }
- },
- invalid_parameter_type: function invalid_parameter_type(fun_name, exp) {
- var context = [exp, _definedFunctions__WEBPACK_IMPORTED_MODULE_3__.LanguageDefinedFunction.getLocalName(fun_name)];
- return createSemanticError("invalid_parameter_type_full", context);
- },
- invalid_ref_full: function invalid_ref_full(id, exp, sourceInfo) {
- if (sourceInfo) {
- var context = [exp, id, sourceInfo.line];
- var error = createSemanticError("invalid_ref_full", context);
- error.context = {
- line: sourceInfo.line,
- column: sourceInfo.column
- };
- return error;
- } else {
- return ProcessorErrorFactory.invalid_ref(id, exp);
- }
- },
- invalid_ref: function invalid_ref(id, exp) {
- var context = [exp, id];
- return createSemanticError("invalid_ref", context);
- },
- unexpected_break_command_full: function unexpected_break_command_full(sourceInfo) {
- if (sourceInfo) {
- var context = [sourceInfo.line];
- var error = createRuntimeError("unexpected_break_command_full", context);
- error.context = {
- line: sourceInfo.line,
- column: sourceInfo.column
- };
- return error;
- } else {
- return ProcessorErrorFactory.unexpected_break_command();
- }
- },
- unexpected_break_command: function unexpected_break_command() {
- return createRuntimeError("unexpected_break_command");
- },
- invalid_array_literal_type_full: function invalid_array_literal_type_full(exp, sourceInfo) {
- if (sourceInfo) {
- var context = [sourceInfo.line, exp];
- var error = createRuntimeError("invalid_array_literal_type_full", context);
- error.context = {
- line: sourceInfo.line,
- column: sourceInfo.column
- };
- return error;
- } else {
- return ProcessorErrorFactory.invalid_array_literal_type(exp);
- }
- },
- invalid_array_literal_type: function invalid_array_literal_type(exp) {
- var context = [exp];
- return createRuntimeError("invalid_array_literal_type", context);
- },
- invalid_array_literal_line_full: function invalid_array_literal_line_full(expected, actual, sourceInfo) {
- if (sourceInfo) {
- var context = [sourceInfo.line, expected, actual];
- var error = createRuntimeError("invalid_array_literal_line_full", context);
- error.context = {
- line: sourceInfo.line,
- column: sourceInfo.column
- };
- return error;
- } else {
- return ProcessorErrorFactory.invalid_array_literal_type(expected, actual);
- }
- },
- invalid_array_literal_line: function invalid_array_literal_line(expected, actual) {
- var context = [expected, actual];
- return createRuntimeError("invalid_array_literal_line", context);
- },
- invalid_array_literal_column_full: function invalid_array_literal_column_full(expected, actual, sourceInfo) {
- if (sourceInfo) {
- var context = [sourceInfo.line, expected, actual];
- var error = createRuntimeError("invalid_array_literal_column_full", context);
- error.context = {
- line: sourceInfo.line,
- column: sourceInfo.column
- };
- return error;
- } else {
- return ProcessorErrorFactory.invalid_array_literal_column(expected, actual);
- }
- },
- invalid_array_literal_column: function invalid_array_literal_column(expected, actual) {
- var context = [expected, actual];
- return createRuntimeError("invalid_array_literal_column", context);
- },
- invalid_unary_op_full: function invalid_unary_op_full(expString, opName, type, dim, sourceInfo) {
- if (sourceInfo) {
- var context = [sourceInfo.line, expString, LocalizedStrings.translateOp(opName), LocalizedStrings.translateType(type, dim)];
- var error = createRuntimeError("invalid_unary_op_full", context);
- error.context = {
- line: sourceInfo.line,
- column: sourceInfo.column
- };
- return error;
- } else {
- return ProcessorErrorFactory.invalid_unary_op(opName, type, dim);
- }
- },
- invalid_unary_op: function invalid_unary_op(expString, opName, type, dim) {
- var context = [expString, LocalizedStrings.translateOp(opName), LocalizedStrings.translateType(type, dim)];
- return createRuntimeError("invalid_unary_op", context);
- },
- invalid_infix_op_full: function invalid_infix_op_full(expString, opName, typeLeft, dimLeft, typeRight, dimRight, sourceInfo) {
- if (sourceInfo) {
- var context = [sourceInfo.line, expString, LocalizedStrings.translateOp(opName), LocalizedStrings.translateType(typeLeft, dimLeft), LocalizedStrings.translateType(typeRight, dimRight)];
- var error = createRuntimeError("invalid_infix_op_full", context);
- error.context = {
- line: sourceInfo.line,
- column: sourceInfo.column
- };
- return error;
- } else {
- return ProcessorErrorFactory.invalid_infix_op(opName, typeLeft, dimLeft, typeRight, dimRight);
- }
- },
- invalid_infix_op: function invalid_infix_op(expString, opName, typeLeft, dimLeft, typeRight, dimRight) {
- var context = [expString, LocalizedStrings.translateOp(opName), LocalizedStrings.translateType(typeLeft, dimLeft), LocalizedStrings.translateType(typeRight, dimRight)];
- return createRuntimeError("invalid_infix_op", context);
- },
- array_dimension_not_positive_full: function array_dimension_not_positive_full(sourceInfo) {
- if (sourceInfo) {
- var context = [sourceInfo.line];
- var error = createSemanticError("array_dimension_not_positive_full", context);
- error.context = {
- line: sourceInfo.line,
- column: sourceInfo.column
- };
- return error;
- } else {
- return ProcessorErrorFactory.array_dimension_not_positive();
- }
- },
- array_dimension_not_positive: function array_dimension_not_positive() {
- return createSemanticError("array_dimension_not_positive");
- },
- invalid_type_conversion: function invalid_type_conversion(value, type, dim) {
- var context = [value, LocalizedStrings.translateType(type, dim)];
- return createRuntimeError("invalid_type_conversion", context);
- },
- invalid_read_type: function invalid_read_type(exp, type, dim, name, source_info) {
- var context = [source_info.line, exp, LocalizedStrings.translateType(type, dim), name];
- var error = createRuntimeError("invalid_read_type", context);
- error.context = {
- line: source_info.line,
- column: source_info.column
- };
- return error;
- },
- invalid_read_type_array: function invalid_read_type_array(exp, typePos, dimPos, name, typeArray, dimArray, sourceInfo) {
- var context = [sourceInfo.line, exp, LocalizedStrings.translateType(typePos, dimPos), name, LocalizedStrings.translateType(typeArray, dimArray)];
- var error = createRuntimeError("invalid_read_type_array", context);
- error.context = {
- line: sourceInfo.line,
- column: sourceInfo.column
- };
- return error;
- },
- invalid_const_ref_full: function invalid_const_ref_full(fun_name, exp, sourceInfo) {
- if (sourceInfo) {
- var context = [exp, _definedFunctions__WEBPACK_IMPORTED_MODULE_3__.LanguageDefinedFunction.getLocalName(fun_name), sourceInfo.line];
- var error = createSemanticError("invalid_const_ref_full", context);
- error.context = {
- line: sourceInfo.line,
- column: sourceInfo.column
- };
- return error;
- } else {
- return ProcessorErrorFactory.invalid_const_ref(fun_name, exp);
- }
- },
- invalid_const_ref: function invalid_const_ref(fun_name, exp) {
- var context = [exp, _definedFunctions__WEBPACK_IMPORTED_MODULE_3__.LanguageDefinedFunction.getLocalName(fun_name)];
- var error = createSemanticError("invalid_const_ref", context);
- return error;
- },
- invalid_const_assignment_full: function invalid_const_assignment_full(var_id, source_info) {
- if (source_info) {
- var context = [source_info.line, var_id];
- var error = createSemanticError("invalid_const_assignment_full", context);
- error.context = {
- line: source_info.line,
- column: source_info.column
- };
- return error;
- } else {
- return ProcessorErrorFactory.invalid_const_assignment(var_id);
- }
- },
- invalid_const_assignment: function invalid_const_assignment(var_id) {
- var context = [var_id];
- return createSemanticError("invalid_const_assignment", context);
- },
- invalid_vector_assignment_full: function invalid_vector_assignment_full(left_id, left_size, right_id, right_size, source_info) {
- if (source_info) {
- var context = [source_info.line, left_id, left_size, right_id, right_size];
- var error = createRuntimeError("invalid_vector_assignment_full", context);
- error.context = {
- line: source_info.line,
- column: source_info.column
- };
- return error;
- } else {
- return ProcessorErrorFactory.invalid_vector_assignment(left_id, left_size, right_id, right_size);
- }
- },
- invalid_vector_assignment: function invalid_vector_assignment(left_id, left_size, right_id, right_size) {
- var context = [left_id, left_size, right_id, right_size];
- return createRuntimeError("invalid_vector_assignment", context);
- },
- invalid_matrix_assignment_full: function invalid_matrix_assignment_full(left_id, left_line, left_column, right_id, right_line, right_column, source_info) {
- if (source_info) {
- var context = [source_info.line, left_id, left_line, left_column, right_id, right_line, right_column];
- var error = createRuntimeError("invalid_matrix_assignment_full", context);
- error.context = {
- line: source_info.line,
- column: source_info.column
- };
- return error;
- } else {
- return ProcessorErrorFactory.invalid_matrix_assignment(left_id, left_line, left_column, right_id, right_line, right_column);
- }
- },
- invalid_matrix_assignment: function invalid_matrix_assignment(left_id, left_line, left_column, right_id, right_line, right_column) {
- var context = [left_id, left_line, left_column, right_id, right_line, right_column];
- return createRuntimeError("invalid_matrix_assignment", context);
- },
- matrix_to_vector_attr: function matrix_to_vector_attr(left_id, right_id, source_info) {
- // SourceInfo have to be valid...
- var context = [source_info.line, right_id, left_id];
- var error = createSemanticError("matrix_to_vector_attr", context);
- error.context = {
- line: source_info.line,
- column: source_info.column
- };
- return error;
- },
- vector_to_matrix_attr: function vector_to_matrix_attr(left_id, right_id, source_info) {
- // SourceInfo have to be valid...
- var context = [source_info.line, right_id, left_id];
- var error = createSemanticError("vector_to_matrix_attr", context);
- error.context = {
- line: source_info.line,
- column: source_info.column
- };
- return error;
- },
- invalid_matrix_index_assign_full: function invalid_matrix_index_assign_full(mat_id, mat_line, mat_size, exp, exp_size, source_info) {
- if (source_info) {
- var context = [source_info.line, mat_line, mat_id, mat_size, exp, exp_size];
- var error = createRuntimeError("invalid_matrix_index_assign_full", context);
- error.context = {
- line: source_info.line,
- column: source_info.column
- };
- return error;
- } else {
- return ProcessorErrorFactory.invalid_matrix_index_assign(mat_id, mat_line, mat_size, exp, exp_size);
- }
- },
- invalid_matrix_index_assign: function invalid_matrix_index_assign(mat_id, mat_line, mat_size, exp, exp_size) {
- var context = [mat_line, mat_id, mat_size, exp, exp_size];
- return createRuntimeError("invalid_matrix_index_assign", context);
- },
- invalid_number_elements_vector: function invalid_number_elements_vector(expected_num, exp, actual_num, source_info) {
- // SourceInfo have to be valid...
- var context = [expected_num, source_info.line, exp, actual_num];
- var error = createRuntimeError("invalid_number_elements_vector", context);
- error.context = {
- line: source_info.line,
- column: source_info.column
- };
- return error;
- },
- invalid_number_lines_matrix: function invalid_number_lines_matrix(expected_num, exp, actual_num, source_info) {
- // SourceInfo have to be valid...
- var context = [expected_num, source_info.line, exp, actual_num];
- var error = createRuntimeError("invalid_number_lines_matrix", context);
- error.context = {
- line: source_info.line,
- column: source_info.column
- };
- return error;
- },
- divsion_by_zero_full: function divsion_by_zero_full(exp, source_info) {
- if (source_info) {
- var context = [source_info.line, exp];
- var error = createRuntimeError("divsion_by_zero_full", context);
- error.context = {
- line: source_info.line,
- column: source_info.column
- };
- return error;
- } else {
- return ProcessorErrorFactory.divsion_by_zero(exp);
- }
- },
- divsion_by_zero: function divsion_by_zero(exp) {
- var context = [exp];
- return createRuntimeError("divsion_by_zero", context);
- },
- undefined_tanget_value: function undefined_tanget_value(value, source_info) {
- var context = [source_info.line, value];
- var error = createRuntimeError("undefined_tanget_value", context);
- error.context = {
- line: source_info.line,
- column: source_info.column
- };
- return error;
- },
- negative_log_value: function negative_log_value(source_info) {
- var error = createRuntimeError("negative_log_value", [source_info.line]);
- error.context = {
- line: source_info.line,
- column: source_info.column
- };
- return error;
- },
- invalid_string_index: function invalid_string_index(index, str, source_info) {
- var local_fun_name = _definedFunctions__WEBPACK_IMPORTED_MODULE_3__.LanguageDefinedFunction.getLocalName("$charAt");
- var context = [source_info.line, local_fun_name, index, str, str.length - 1];
- var error = createRuntimeError("invalid_string_index", context);
- error.context = {
- line: source_info.line,
- column: source_info.column
- };
- return error;
- },
- negative_sqrt_value: function negative_sqrt_value(source_info) {
- var error = createRuntimeError("negative_sqrt_value", [source_info.line]);
- error.context = {
- line: source_info.line,
- column: source_info.column
- };
- return error;
- },
- /**
- * @deprecated 01/10/2019
- */
- exceeded_recursive_calls: function exceeded_recursive_calls(source_info) {
- var context = [source_info.line];
- var error = createRuntimeError("exceeded_recursive_calls", context);
- error.context = {
- line: source_info.line,
- column: source_info.column
- };
- return error;
- },
- invalid_for_variable: function invalid_for_variable(id, source_info) {
- var context = [source_info.line, id];
- var error = createSemanticError("invalid_for_variable", context);
- error.context = {
- line: source_info.line,
- column: source_info.column
- };
- return error;
- },
- invalid_for_from: function invalid_for_from(exp, source_info) {
- var context = [source_info.line, exp];
- var error = createSemanticError("invalid_for_from", context);
- error.context = {
- line: source_info.line,
- column: source_info.column
- };
- return error;
- },
- invalid_for_to: function invalid_for_to(exp, source_info) {
- var context = [source_info.line, exp];
- var error = createSemanticError("invalid_for_to", context);
- error.context = {
- line: source_info.line,
- column: source_info.column
- };
- return error;
- },
- invalid_for_pass: function invalid_for_pass(exp, source_info) {
- var context = [source_info.line, exp];
- var error = createSemanticError("invalid_for_pass", context);
- error.context = {
- line: source_info.line,
- column: source_info.column
- };
- return error;
- },
- exceed_max_instructions: function exceed_max_instructions() {
- return createRuntimeError("exceed_max_instructions");
- }
- });
- /***/ }),
- /***/ "./js/processor/error/runtimeError.js":
- /*!********************************************!*\
- !*** ./js/processor/error/runtimeError.js ***!
- \********************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "RuntimeError": () => (/* binding */ RuntimeError)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/assertThisInitialized */ "./node_modules/@babel/runtime/helpers/assertThisInitialized.js");
- /* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3__);
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__);
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__);
- /* harmony import */ var _babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/wrapNativeSuper */ "./node_modules/@babel/runtime/helpers/wrapNativeSuper.js");
- /* harmony import */ var _babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_6__);
- 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); }; }
- 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; } }
- var RuntimeError = /*#__PURE__*/function (_Error) {
- _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3___default()(RuntimeError, _Error);
- var _super = _createSuper(RuntimeError);
- function RuntimeError(msg, id) {
- var _this;
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, RuntimeError);
- _this = _super.call(this, msg);
- _this.id = id;
- _this._context = {};
- if (Error.captureStackTrace) Error.captureStackTrace(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2___default()(_this), RuntimeError);
- return _this;
- }
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(RuntimeError, [{
- key: "context",
- get: function get() {
- return this._context;
- },
- set: function set(contextObj) {
- this._context = contextObj;
- }
- }]);
- return RuntimeError;
- }( /*#__PURE__*/_babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_6___default()(Error));
- /***/ }),
- /***/ "./js/processor/error/semanticError.js":
- /*!*********************************************!*\
- !*** ./js/processor/error/semanticError.js ***!
- \*********************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "SemanticError": () => (/* binding */ SemanticError)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/assertThisInitialized */ "./node_modules/@babel/runtime/helpers/assertThisInitialized.js");
- /* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3__);
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__);
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__);
- /* harmony import */ var _babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/wrapNativeSuper */ "./node_modules/@babel/runtime/helpers/wrapNativeSuper.js");
- /* harmony import */ var _babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_6__);
- 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); }; }
- 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; } }
- var SemanticError = /*#__PURE__*/function (_Error) {
- _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3___default()(SemanticError, _Error);
- var _super = _createSuper(SemanticError);
- function SemanticError(msg, id) {
- var _this;
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, SemanticError);
- _this = _super.call(this, msg);
- _this.id = id;
- _this._context = {};
- if (Error.captureStackTrace) Error.captureStackTrace(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2___default()(_this), SemanticError);
- return _this;
- }
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(SemanticError, [{
- key: "context",
- get: function get() {
- return this._context;
- },
- set: function set(contextObj) {
- this._context = contextObj;
- }
- }]);
- return SemanticError;
- }( /*#__PURE__*/_babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_6___default()(Error));
- /***/ }),
- /***/ "./js/processor/ivprogProcessor.js":
- /*!*****************************************!*\
- !*** ./js/processor/ivprogProcessor.js ***!
- \*****************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "IVProgProcessor": () => (/* binding */ IVProgProcessor)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "./node_modules/@babel/runtime/helpers/slicedToArray.js");
- /* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js");
- /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js");
- /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_3__);
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_4__);
- /* harmony import */ var _store_store__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./store/store */ "./js/processor/store/store.ts");
- /* harmony import */ var _modes__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./modes */ "./js/processor/modes.ts");
- /* harmony import */ var _context__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./context */ "./js/processor/context.ts");
- /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.ts");
- /* harmony import */ var _ast_operators__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./../ast/operators */ "./js/ast/operators.ts");
- /* harmony import */ var _definedFunctions__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./definedFunctions */ "./js/processor/definedFunctions.js");
- /* harmony import */ var _compatibilityTable__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./compatibilityTable */ "./js/processor/compatibilityTable.ts");
- /* harmony import */ var _ast_commands___WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./../ast/commands/ */ "./js/ast/commands/index.js");
- /* harmony import */ var _ast_commands_command__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./../ast/commands/command */ "./js/ast/commands/command.js");
- /* harmony import */ var _ast_expressions___WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./../ast/expressions/ */ "./js/ast/expressions/index.js");
- /* harmony import */ var _ast_expressions_expression__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./../ast/expressions/expression */ "./js/ast/expressions/expression.js");
- /* harmony import */ var _util_utils__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./../util/utils */ "./js/util/utils.js");
- /* harmony import */ var _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./../typeSystem/array_type */ "./js/typeSystem/array_type.ts");
- /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../typeSystem/parsers */ "./js/typeSystem/parsers.js");
- /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../util/config */ "./js/util/config.ts");
- /* harmony import */ var _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
- /* harmony import */ var _error_runtimeError__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./error/runtimeError */ "./js/processor/error/runtimeError.js");
- /* harmony import */ var _memory_location__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../memory/location */ "./js/memory/location.ts");
- /* harmony import */ var _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./store/value/store_value */ "./js/processor/store/value/store_value.ts");
- /* 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");
- /* 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");
- /* 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");
- /* 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");
- /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ../services/localizedStringsService */ "./js/services/localizedStringsService.js");
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
- var IVProgProcessor = /*#__PURE__*/function () {
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_4___default()(IVProgProcessor, null, [{
- key: "MAIN_INTERNAL_ID",
- get: function get() {
- return "$main";
- }
- }]);
- function IVProgProcessor(ast) {
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_3___default()(this, IVProgProcessor);
- this.ast = ast;
- this.globalStore = new _store_store__WEBPACK_IMPORTED_MODULE_5__.Store("$global");
- this.stores = [this.globalStore];
- this.context = [_context__WEBPACK_IMPORTED_MODULE_7__.Context.BASE];
- this.input = null;
- this.forceKill = false;
- this.output = null;
- this.mode = _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.RUN;
- /**
- * Stores the sourceInfo of every function call, command or expression
- */
- this.function_call_stack = [];
- this.instruction_count = 0;
- this.function_call_count = 0;
- }
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_4___default()(IVProgProcessor, [{
- key: "registerInput",
- value: function registerInput(input) {
- if (this.input !== null) this.input = null;
- this.input = input;
- }
- }, {
- key: "registerOutput",
- value: function registerOutput(output) {
- if (this.output !== null) this.output = null;
- this.output = output;
- }
- }, {
- key: "checkContext",
- value: function checkContext(context) {
- return this.context[this.context.length - 1] === context;
- }
- }, {
- key: "ignoreSwitchCases",
- value: function ignoreSwitchCases(store) {
- if (store.mode === _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.RETURN) {
- return true;
- } else if (store.mode === _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.BREAK) {
- return true;
- } else {
- return false;
- }
- }
- }, {
- key: "prepareState",
- value: function prepareState() {
- if (this.stores !== null) {
- for (var i = 0; i < this.stores.length; i++) {
- delete this.stores[i];
- }
- this.stores = null;
- }
- if (this.globalStore !== null) this.globalStore = null;
- this.globalStore = new _store_store__WEBPACK_IMPORTED_MODULE_5__.Store("$global");
- this.stores = [this.globalStore];
- this.context = [_context__WEBPACK_IMPORTED_MODULE_7__.Context.BASE];
- this.instruction_count = 0;
- this.mode = _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.RUN;
- }
- }, {
- key: "interpretAST",
- value: function () {
- var _interpretAST = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee() {
- var mainFunc;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- this.prepareState();
- _memory_location__WEBPACK_IMPORTED_MODULE_22__.Location.clear();
- _context.next = 4;
- return this.initGlobal();
- case 4:
- mainFunc = this.findMainFunction();
- if (!(mainFunc === null)) {
- _context.next = 7;
- break;
- }
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.main_missing();
- case 7:
- return _context.abrupt("return", this.runFunction(mainFunc, [], this.globalStore));
- case 8:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- function interpretAST() {
- return _interpretAST.apply(this, arguments);
- }
- return interpretAST;
- }()
- }, {
- key: "initGlobal",
- value: function () {
- var _initGlobal = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee2() {
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee2$(_context2) {
- while (1) {
- switch (_context2.prev = _context2.next) {
- case 0:
- if (this.checkContext(_context__WEBPACK_IMPORTED_MODULE_7__.Context.BASE)) {
- _context2.next = 2;
- break;
- }
- return _context2.abrupt("return", _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.invalid_global_var());
- case 2:
- return _context2.abrupt("return", this.executeCommands(this.globalStore, this.ast.global));
- case 3:
- case "end":
- return _context2.stop();
- }
- }
- }, _callee2, this);
- }));
- function initGlobal() {
- return _initGlobal.apply(this, arguments);
- }
- return initGlobal;
- }()
- }, {
- key: "findMainFunction",
- value: function findMainFunction() {
- return this.ast.functions.find(function (v) {
- return v.isMain;
- });
- }
- }, {
- key: "findFunction",
- value: function findFunction(name) {
- if (name.match(/^\$.+$/)) {
- if (name === IVProgProcessor.MAIN_INTERNAL_ID) {
- return this.findMainFunction();
- }
- var fun = _definedFunctions__WEBPACK_IMPORTED_MODULE_10__.LanguageDefinedFunction.getFunction(name);
- if (!fun) {
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.not_implemented(name);
- }
- return fun;
- } else {
- var val = this.ast.functions.find(function (v) {
- return v.name === name;
- });
- if (!val) {
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.function_missing(name);
- }
- return val;
- }
- }
- }, {
- key: "runFunction",
- value: function () {
- 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) {
- var funcName, funcStore, stoWithVars, finalSto;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee3$(_context3) {
- while (1) {
- switch (_context3.prev = _context3.next) {
- case 0:
- funcName = func.isMain ? IVProgProcessor.MAIN_INTERNAL_ID : func.name;
- funcStore = new _store_store__WEBPACK_IMPORTED_MODULE_5__.Store(funcName);
- funcStore.extendStore(this.globalStore);
- _context3.next = 5;
- return this.associateParameters(func.formalParameters, actualParameters, store, funcStore);
- case 5:
- this.context.push(_context__WEBPACK_IMPORTED_MODULE_7__.Context.FUNCTION);
- this.stores.push(funcStore);
- _context3.next = 9;
- return this.executeCommands(funcStore, func.variablesDeclarations);
- case 9:
- stoWithVars = _context3.sent;
- _context3.next = 12;
- return this.executeCommands(stoWithVars, func.commands);
- case 12:
- finalSto = _context3.sent;
- this.stores.pop();
- this.context.pop();
- return _context3.abrupt("return", finalSto);
- case 16:
- case "end":
- return _context3.stop();
- }
- }
- }, _callee3, this);
- }));
- function runFunction(_x, _x2, _x3) {
- return _runFunction.apply(this, arguments);
- }
- return runFunction;
- }()
- /**
- *
- * @param {import('./../ast/commands/formalParameter').FormalParameter[]} formal_params
- * @param {Expression[]} effective_params
- * @param {Store} caller_store
- * @param {Store} callee_store
- */
- }, {
- key: "associateParameters",
- value: function () {
- 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) {
- var funcName, hasVariadic, i, j, formalParameter, _yield$this$associate, _yield$this$associate2, actualParam;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee4$(_context4) {
- while (1) {
- switch (_context4.prev = _context4.next) {
- case 0:
- funcName = callee_store.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions__WEBPACK_IMPORTED_MODULE_10__.LanguageDefinedFunction.getMainFunctionName() : callee_store.name;
- hasVariadic = formal_params.some(function (p) {
- return p.variadic;
- });
- if (!(formal_params.length != effective_params.length && !hasVariadic || formal_params.length > effective_params.length)) {
- _context4.next = 4;
- break;
- }
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.invalid_parameters_size(funcName, formal_params.length, effective_params.length);
- case 4:
- i = 0, j = 0;
- case 5:
- if (!(i < formal_params.length && j < effective_params.length)) {
- _context4.next = 23;
- break;
- }
- formalParameter = formal_params[i];
- if (!formalParameter.variadic) {
- _context4.next = 16;
- break;
- }
- _context4.next = 10;
- return this.associateVariadicParameter(funcName, formalParameter, j, effective_params, caller_store, callee_store);
- case 10:
- _yield$this$associate = _context4.sent;
- _yield$this$associate2 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default()(_yield$this$associate, 2);
- j = _yield$this$associate2[0];
- callee_store = _yield$this$associate2[1];
- _context4.next = 20;
- break;
- case 16:
- actualParam = effective_params[i];
- _context4.next = 19;
- return this.associateParameter(funcName, formalParameter, actualParam, caller_store, callee_store);
- case 19:
- callee_store = _context4.sent;
- case 20:
- i += 1, j += 1;
- _context4.next = 5;
- break;
- case 23:
- return _context4.abrupt("return", callee_store);
- case 24:
- case "end":
- return _context4.stop();
- }
- }
- }, _callee4, this);
- }));
- function associateParameters(_x4, _x5, _x6, _x7) {
- return _associateParameters.apply(this, arguments);
- }
- return associateParameters;
- }()
- /**
- *
- * @param {string} funcName
- * @param {import('./../ast/commands/formalParameter').FormalParameter} formalParameter
- * @param {number} index
- * @param {Expression[]} effective_params
- * @param {Store} caller_store
- * @param {Store} callee_store
- */
- }, {
- key: "associateVariadicParameter",
- value: function () {
- 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) {
- var i, count, actualParam, variadicCount;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee5$(_context5) {
- while (1) {
- switch (_context5.prev = _context5.next) {
- case 0:
- count = 1;
- i = index;
- case 2:
- if (!(i < effective_params.length)) {
- _context5.next = 11;
- break;
- }
- actualParam = effective_params[i];
- _context5.next = 6;
- return this.associateParameter(funcName, formalParameter, actualParam, caller_store, callee_store, count);
- case 6:
- callee_store = _context5.sent;
- count += 1;
- case 8:
- i += 1;
- _context5.next = 2;
- break;
- case 11:
- variadicCount = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.INTEGER, count, undefined, true);
- callee_store.insertStore("".concat(formalParameter.id, ".0"), variadicCount);
- return _context5.abrupt("return", [i - 1, callee_store]);
- case 14:
- case "end":
- return _context5.stop();
- }
- }
- }, _callee5, this);
- }));
- function associateVariadicParameter(_x8, _x9, _x10, _x11, _x12, _x13) {
- return _associateVariadicParameter.apply(this, arguments);
- }
- return associateVariadicParameter;
- }()
- /**
- *
- * @param {string} funcName
- * @param {import('./../ast/commands/formalParameter').FormalParameter} formalParameter
- * @param {Expression} actualParameter
- * @param {Store} callerStore
- * @param {Store} calleeStore
- * @param {number} variadicCount The number of the current value being assigned to the variadic parameter, default 0
- */
- }, {
- key: "associateParameter",
- value: function () {
- 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) {
- var variadicCount,
- actualValue,
- shouldTypeCast,
- realObj,
- ref,
- values,
- array_type,
- addresses,
- columns,
- line,
- column,
- varID,
- realValue,
- _varID,
- _args6 = arguments;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee6$(_context6) {
- while (1) {
- switch (_context6.prev = _context6.next) {
- case 0:
- variadicCount = _args6.length > 5 && _args6[5] !== undefined ? _args6[5] : 0;
- _context6.next = 3;
- return this.evaluateExpression(callerStore, actualParameter);
- case 3:
- actualValue = _context6.sent;
- shouldTypeCast = false;
- if (formalParameter.type.isCompatible(actualValue.type)) {
- _context6.next = 11;
- break;
- }
- 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))) {
- _context6.next = 10;
- break;
- }
- shouldTypeCast = true;
- _context6.next = 11;
- break;
- case 10:
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.invalid_parameter_type(funcName, actualParameter.toString());
- case 11:
- if (!(formalParameter.byRef && !actualValue.inStore())) {
- _context6.next = 13;
- break;
- }
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.invalid_ref(funcName, actualParameter.toString());
- case 13:
- if (formalParameter.byRef) {
- realObj = callerStore.getStoreObject(actualValue.id);
- ref = null;
- if (actualValue instanceof _store_value_array_store_value__WEBPACK_IMPORTED_MODULE_25__.ArrayStoreValue) {
- // it's a vector or matrix...
- values = actualValue.get();
- array_type = actualValue.type;
- addresses = values.map(function (v) {
- return realObj.getLocAddressOf(v.line, v.column);
- });
- columns = actualValue.isVector() ? 0 : actualValue.columns;
- ref = new _store_value_array_store_value_ref__WEBPACK_IMPORTED_MODULE_26__.ArrayStoreValueRef(array_type, values, addresses, actualValue.lines, columns, realObj.id);
- } else {
- if (actualValue instanceof _store_value_store_value_address__WEBPACK_IMPORTED_MODULE_27__.StoreValueAddress) {
- line = actualValue.line;
- column = actualValue.column;
- ref = new _store_value_store_value_ref__WEBPACK_IMPORTED_MODULE_24__.StoreValueRef(actualValue.type, actualValue.get(), realObj.getLocAddressOf(line, column), realObj.id);
- ref.setReferenceDimension(realObj.type.dimensions);
- } else {
- ref = new _store_value_store_value_ref__WEBPACK_IMPORTED_MODULE_24__.StoreValueRef(actualValue.type, actualValue.get(), realObj.locAddress, realObj.id);
- }
- }
- varID = formalParameter.id;
- if (formalParameter.variadic) varID = "".concat(varID, ".").concat(variadicCount);
- calleeStore.insertStore(varID, ref);
- } else {
- realValue = actualValue;
- if (shouldTypeCast) {
- realValue = _store_store__WEBPACK_IMPORTED_MODULE_5__.Store.doImplicitCasting(formalParameter.type, realValue);
- }
- _varID = formalParameter.id;
- if (formalParameter.variadic) _varID = "".concat(_varID, ".").concat(variadicCount);
- calleeStore.insertStore(_varID, realValue);
- }
- return _context6.abrupt("return", calleeStore);
- case 15:
- case "end":
- return _context6.stop();
- }
- }
- }, _callee6, this);
- }));
- function associateParameter(_x14, _x15, _x16, _x17, _x18) {
- return _associateParameter.apply(this, arguments);
- }
- return associateParameter;
- }()
- /**
- *
- * @param {Store} store
- * @param {Command[]} cmds
- *
- * @returns {Promise<Store>}
- */
- }, {
- key: "executeCommands",
- value: function () {
- 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) {
- var sto, i;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee7$(_context7) {
- while (1) {
- switch (_context7.prev = _context7.next) {
- case 0:
- // helper to partially apply a function, in this case executeCommand
- sto = store;
- i = 0;
- case 2:
- if (!(i < cmds.length)) {
- _context7.next = 9;
- break;
- }
- _context7.next = 5;
- return this.executeCommand(sto, cmds[i]);
- case 5:
- sto = _context7.sent;
- case 6:
- i += 1;
- _context7.next = 2;
- break;
- case 9:
- return _context7.abrupt("return", sto);
- case 10:
- case "end":
- return _context7.stop();
- }
- }
- }, _callee7, this);
- }));
- function executeCommands(_x19, _x20) {
- return _executeCommands.apply(this, arguments);
- }
- return executeCommands;
- }()
- /**
- *
- * @param {Store} store
- * @param {Command} cmd
- *
- * @returns {Promise<Store>}
- */
- }, {
- key: "executeCommand",
- value: function () {
- 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) {
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee8$(_context8) {
- while (1) {
- switch (_context8.prev = _context8.next) {
- case 0:
- this.instruction_count += 1;
- if (!(this.instruction_count % _util_config__WEBPACK_IMPORTED_MODULE_19__.Config.suspend_threshold == 0)) {
- _context8.next = 4;
- break;
- }
- _context8.next = 4;
- return _util_utils__WEBPACK_IMPORTED_MODULE_16__.sleep(3);
- case 4:
- if (!(this.instruction_count >= _util_config__WEBPACK_IMPORTED_MODULE_19__.Config.max_instruction_count)) {
- _context8.next = 8;
- break;
- }
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.exceed_max_instructions();
- case 8:
- if (!this.forceKill) {
- _context8.next = 12;
- break;
- }
- throw "FORCED_KILL!";
- case 12:
- if (!(store.mode === _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.PAUSE)) {
- _context8.next = 16;
- break;
- }
- return _context8.abrupt("return", this.executeCommand(store, cmd));
- case 16:
- if (!(store.mode === _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.RETURN)) {
- _context8.next = 20;
- break;
- }
- return _context8.abrupt("return", store);
- case 20:
- if (!(this.checkContext(_context__WEBPACK_IMPORTED_MODULE_7__.Context.BREAKABLE) && store.mode === _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.BREAK)) {
- _context8.next = 24;
- break;
- }
- return _context8.abrupt("return", store);
- case 24:
- if (!(this.mode === _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.ABORT)) {
- _context8.next = 26;
- break;
- }
- throw _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_28__.LocalizedStrings.getMessage("aborted_execution");
- case 26:
- if (!(cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_12__.Declaration)) {
- _context8.next = 30;
- break;
- }
- return _context8.abrupt("return", this.executeDeclaration(store, cmd));
- case 30:
- if (!(cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_12__.ArrayIndexAssign)) {
- _context8.next = 34;
- break;
- }
- return _context8.abrupt("return", this.executeArrayIndexAssign(store, cmd));
- case 34:
- if (!(cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_12__.Assign)) {
- _context8.next = 38;
- break;
- }
- return _context8.abrupt("return", this.executeAssign(store, cmd));
- case 38:
- if (!(cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_12__.Break)) {
- _context8.next = 42;
- break;
- }
- return _context8.abrupt("return", this.executeBreak(store, cmd));
- case 42:
- if (!(cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_12__.Return)) {
- _context8.next = 46;
- break;
- }
- return _context8.abrupt("return", this.executeReturn(store, cmd));
- case 46:
- if (!(cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_12__.IfThenElse)) {
- _context8.next = 50;
- break;
- }
- return _context8.abrupt("return", this.executeIfThenElse(store, cmd));
- case 50:
- if (!(cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_12__.RepeatUntil)) {
- _context8.next = 54;
- break;
- }
- return _context8.abrupt("return", this.executeRepeatUntil(store, cmd));
- case 54:
- if (!(cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_12__.While)) {
- _context8.next = 58;
- break;
- }
- return _context8.abrupt("return", this.executeWhile(store, cmd));
- case 58:
- if (!(cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_12__.For)) {
- _context8.next = 62;
- break;
- }
- return _context8.abrupt("return", this.executeFor(store, cmd));
- case 62:
- if (!(cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_12__.Switch)) {
- _context8.next = 66;
- break;
- }
- return _context8.abrupt("return", this.executeSwitch(store, cmd));
- case 66:
- if (!(cmd instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_14__.FunctionCall)) {
- _context8.next = 70;
- break;
- }
- return _context8.abrupt("return", this.executeFunctionCall(store, cmd));
- case 70:
- if (!(cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_12__.SysCall)) {
- _context8.next = 74;
- break;
- }
- return _context8.abrupt("return", this.executeSysCall(store, cmd));
- case 74:
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.unknown_command(cmd.sourceInfo);
- case 75:
- case "end":
- return _context8.stop();
- }
- }
- }, _callee8, this);
- }));
- function executeCommand(_x21, _x22) {
- return _executeCommand.apply(this, arguments);
- }
- return executeCommand;
- }()
- /**
- *
- * @param {Store} store
- * @param {Commands.SysCall} cmd
- *
- * @returns {Promise<Store>}
- */
- }, {
- key: "executeSysCall",
- value: function () {
- 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) {
- var func;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee9$(_context9) {
- while (1) {
- switch (_context9.prev = _context9.next) {
- case 0:
- func = cmd.langFunc.bind(this);
- return _context9.abrupt("return", func(store, cmd));
- case 2:
- case "end":
- return _context9.stop();
- }
- }
- }, _callee9, this);
- }));
- function executeSysCall(_x23, _x24) {
- return _executeSysCall.apply(this, arguments);
- }
- return executeSysCall;
- }()
- /**
- *
- * @param {Store} store
- * @param {Commands.FunctionCall} cmd
- *
- * @returns {Promise<Store>}
- */
- }, {
- key: "executeFunctionCall",
- value: function () {
- 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) {
- var func, sto, funcName;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee10$(_context10) {
- while (1) {
- switch (_context10.prev = _context10.next) {
- case 0:
- func = null;
- if (cmd.isMainCall) {
- func = this.findMainFunction();
- } else {
- func = this.findFunction(cmd.id);
- }
- this.function_call_stack.push(cmd.sourceInfo);
- _context10.next = 5;
- return this.runFunction(func, cmd.actualParameters, store);
- case 5:
- sto = _context10.sent;
- sto.destroy();
- if (!(!_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.VOID.isCompatible(func.returnType) && sto.mode !== _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.RETURN)) {
- _context10.next = 12;
- break;
- }
- funcName = func.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions__WEBPACK_IMPORTED_MODULE_10__.LanguageDefinedFunction.getMainFunctionName() : func.name;
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.function_no_return(funcName);
- case 12:
- this.function_call_stack.pop();
- return _context10.abrupt("return", store);
- case 14:
- case "end":
- return _context10.stop();
- }
- }
- }, _callee10, this);
- }));
- function executeFunctionCall(_x25, _x26) {
- return _executeFunctionCall.apply(this, arguments);
- }
- return executeFunctionCall;
- }()
- /**
- *
- * @param {Store} store
- * @param {Commands.Switch} cmd
- *
- * @returns {Promise<Store>}
- */
- }, {
- key: "executeSwitch",
- value: function () {
- 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) {
- var switchCases, lastStore, lastCaseCheckResult, i, switchCase, equalityInfixApp, result;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee11$(_context11) {
- while (1) {
- switch (_context11.prev = _context11.next) {
- case 0:
- this.context.push(_context__WEBPACK_IMPORTED_MODULE_7__.Context.BREAKABLE);
- switchCases = cmd.cases;
- lastStore = store;
- lastCaseCheckResult = false;
- i = 0;
- case 5:
- if (!(i < switchCases.length && !this.ignoreSwitchCases(lastStore))) {
- _context11.next = 26;
- break;
- }
- switchCase = switchCases[i];
- if (!(lastCaseCheckResult || switchCase.isDefault)) {
- _context11.next = 13;
- break;
- }
- _context11.next = 10;
- return this.executeCommands(lastStore, switchCase.commands);
- case 10:
- lastStore = _context11.sent;
- _context11.next = 23;
- break;
- case 13:
- equalityInfixApp = new _ast_expressions___WEBPACK_IMPORTED_MODULE_14__.InfixApp(_ast_operators__WEBPACK_IMPORTED_MODULE_9__.Operators.EQ, cmd.expression, switchCase.expression);
- equalityInfixApp.sourceInfo = switchCase.sourceInfo;
- _context11.next = 17;
- return this.evaluateExpression(lastStore, equalityInfixApp);
- case 17:
- result = _context11.sent;
- if (!result.get()) {
- _context11.next = 22;
- break;
- }
- _context11.next = 21;
- return this.executeCommands(lastStore, switchCase.commands);
- case 21:
- lastStore = _context11.sent;
- case 22:
- lastCaseCheckResult = result.get();
- case 23:
- i += 1;
- _context11.next = 5;
- break;
- case 26:
- this.context.pop();
- if (lastStore.mode === _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.BREAK) {
- lastStore.mode = _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.RUN;
- }
- return _context11.abrupt("return", lastStore);
- case 29:
- case "end":
- return _context11.stop();
- }
- }
- }, _callee11, this);
- }));
- function executeSwitch(_x27, _x28) {
- return _executeSwitch.apply(this, arguments);
- }
- return executeSwitch;
- }()
- /**
- *
- * @param {Store} store
- * @param {Commands.For} cmd
- *
- * @returns {Promise<Store>}
- */
- }, {
- key: "executeFor",
- value: function () {
- 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) {
- var initCmd, passValue, condition, checkEndGTBegin, isForward, increment, whileBlock, forAsWhile, newCmdList;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee12$(_context12) {
- while (1) {
- switch (_context12.prev = _context12.next) {
- case 0:
- //BEGIN for -> while rewrite
- initCmd = new _ast_commands___WEBPACK_IMPORTED_MODULE_12__.Assign(cmd.for_id.id, cmd.for_from);
- initCmd.sourceInfo = cmd.sourceInfo; // Assume for is iterating forward and that pass is not missing
- passValue = cmd.for_pass;
- condition = new _ast_expressions___WEBPACK_IMPORTED_MODULE_14__.InfixApp(_ast_operators__WEBPACK_IMPORTED_MODULE_9__.Operators.LT, cmd.for_id, cmd.for_to);
- if (!(cmd.for_pass == null)) {
- _context12.next = 12;
- break;
- }
- passValue = new _ast_expressions___WEBPACK_IMPORTED_MODULE_14__.IntLiteral((0,_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_18__.toInt)(1));
- _context12.next = 8;
- 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));
- case 8:
- checkEndGTBegin = _context12.sent;
- if (!checkEndGTBegin.get()) {
- passValue = new _ast_expressions___WEBPACK_IMPORTED_MODULE_14__.IntLiteral((0,_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_18__.toInt)(-1));
- condition = new _ast_expressions___WEBPACK_IMPORTED_MODULE_14__.InfixApp(_ast_operators__WEBPACK_IMPORTED_MODULE_9__.Operators.GT, cmd.for_id, cmd.for_to);
- }
- _context12.next = 16;
- break;
- case 12:
- _context12.next = 14;
- 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))));
- case 14:
- isForward = _context12.sent;
- if (!isForward.get()) {
- condition = new _ast_expressions___WEBPACK_IMPORTED_MODULE_14__.InfixApp(_ast_operators__WEBPACK_IMPORTED_MODULE_9__.Operators.GT, cmd.for_id, cmd.for_to);
- }
- case 16:
- condition.sourceInfo = cmd.sourceInfo;
- 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));
- increment.sourceInfo = cmd.sourceInfo;
- whileBlock = new _ast_commands___WEBPACK_IMPORTED_MODULE_12__.CommandBlock([], cmd.commands.concat(increment));
- forAsWhile = new _ast_commands___WEBPACK_IMPORTED_MODULE_12__.While(condition, whileBlock);
- forAsWhile.sourceInfo = cmd.sourceInfo; //END for -> while rewrite
- newCmdList = [initCmd, forAsWhile];
- return _context12.abrupt("return", this.executeCommands(store, newCmdList));
- case 24:
- case "end":
- return _context12.stop();
- }
- }
- }, _callee12, this);
- }));
- function executeFor(_x29, _x30) {
- return _executeFor.apply(this, arguments);
- }
- return executeFor;
- }()
- /**
- *
- * @param {Store} store
- * @param {Commands.RepeatUntil} cmd
- *
- * @returns {Promise<Store>}
- */
- }, {
- key: "executeRepeatUntil",
- value: function () {
- 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) {
- var sto, checkCondition;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee13$(_context13) {
- while (1) {
- switch (_context13.prev = _context13.next) {
- case 0:
- this.context.push(_context__WEBPACK_IMPORTED_MODULE_7__.Context.BREAKABLE);
- _context13.next = 3;
- return this.executeCommands(store, cmd.commands);
- case 3:
- sto = _context13.sent;
- if (!(sto.mode === _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.BREAK)) {
- _context13.next = 8;
- break;
- }
- this.context.pop();
- sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.RUN;
- return _context13.abrupt("return", sto);
- case 8:
- _context13.next = 10;
- return this.evaluateExpression(sto, cmd.expression);
- case 10:
- checkCondition = _context13.sent;
- if (checkCondition.type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.BOOLEAN)) {
- _context13.next = 13;
- break;
- }
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.loop_condition_type_full(cmd.sourceInfo);
- case 13:
- this.context.pop();
- if (!checkCondition.get()) {
- _context13.next = 18;
- break;
- }
- return _context13.abrupt("return", sto);
- case 18:
- return _context13.abrupt("return", this.executeCommand(sto, cmd));
- case 19:
- case "end":
- return _context13.stop();
- }
- }
- }, _callee13, this);
- }));
- function executeRepeatUntil(_x31, _x32) {
- return _executeRepeatUntil.apply(this, arguments);
- }
- return executeRepeatUntil;
- }()
- /**
- *
- * @param {Store} store
- * @param {Commands.While} cmd
- *
- * @returns {Promise<Store>}
- */
- }, {
- key: "executeWhile",
- value: function () {
- 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) {
- var checkCondition, sto;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee14$(_context14) {
- while (1) {
- switch (_context14.prev = _context14.next) {
- case 0:
- this.context.push(_context__WEBPACK_IMPORTED_MODULE_7__.Context.BREAKABLE);
- _context14.next = 3;
- return this.evaluateExpression(store, cmd.expression);
- case 3:
- checkCondition = _context14.sent;
- if (checkCondition.type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.BOOLEAN)) {
- _context14.next = 6;
- break;
- }
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.loop_condition_type_full(cmd.expression.toString(), cmd.sourceInfo);
- case 6:
- if (!checkCondition.get()) {
- _context14.next = 17;
- break;
- }
- _context14.next = 9;
- return this.executeCommands(store, cmd.commands);
- case 9:
- sto = _context14.sent;
- this.context.pop();
- if (!(sto.mode === _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.BREAK)) {
- _context14.next = 14;
- break;
- }
- sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.RUN;
- return _context14.abrupt("return", sto);
- case 14:
- return _context14.abrupt("return", this.executeCommand(sto, cmd));
- case 17:
- this.context.pop();
- return _context14.abrupt("return", store);
- case 19:
- case "end":
- return _context14.stop();
- }
- }
- }, _callee14, this);
- }));
- function executeWhile(_x33, _x34) {
- return _executeWhile.apply(this, arguments);
- }
- return executeWhile;
- }()
- /**
- *
- * @param {Store} store
- * @param {Commands.IfThenElse} cmd
- *
- * @returns {Promise<Store>}
- */
- }, {
- key: "executeIfThenElse",
- value: function () {
- 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) {
- var isTrue;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee15$(_context15) {
- while (1) {
- switch (_context15.prev = _context15.next) {
- case 0:
- _context15.next = 2;
- return this.evaluateExpression(store, cmd.condition);
- case 2:
- isTrue = _context15.sent;
- if (isTrue.type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.BOOLEAN)) {
- _context15.next = 5;
- break;
- }
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.if_condition_type_full(cmd.condition.toString(), cmd.sourceInfo);
- case 5:
- if (!isTrue.get()) {
- _context15.next = 9;
- break;
- }
- return _context15.abrupt("return", this.executeCommands(store, cmd.ifTrue.commands));
- case 9:
- if (!(cmd.ifFalse !== null)) {
- _context15.next = 17;
- break;
- }
- if (!(cmd.ifFalse instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_12__.IfThenElse)) {
- _context15.next = 14;
- break;
- }
- return _context15.abrupt("return", this.executeCommand(store, cmd.ifFalse));
- case 14:
- return _context15.abrupt("return", this.executeCommands(store, cmd.ifFalse.commands));
- case 15:
- _context15.next = 18;
- break;
- case 17:
- return _context15.abrupt("return", store);
- case 18:
- case "end":
- return _context15.stop();
- }
- }
- }, _callee15, this);
- }));
- function executeIfThenElse(_x35, _x36) {
- return _executeIfThenElse.apply(this, arguments);
- }
- return executeIfThenElse;
- }()
- /**
- *
- * @param {Store} store
- * @param {Commands.Return} cmd
- *
- * @returns {Promise<Store>}
- */
- }, {
- key: "executeReturn",
- value: function () {
- 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) {
- var funcName, func, funcType, value, real_value, stringInfo, info;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee16$(_context16) {
- while (1) {
- switch (_context16.prev = _context16.next) {
- case 0:
- 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);
- func = this.findFunction(store.name);
- funcType = func.returnType;
- _context16.next = 5;
- return this.evaluateExpression(store, cmd.expression);
- case 5:
- value = _context16.sent;
- if (!(value === null && funcType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.VOID))) {
- _context16.next = 9;
- break;
- }
- store.mode = _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.RETURN;
- return _context16.abrupt("return", store);
- case 9:
- real_value = value;
- if (!(value === null || !funcType.isCompatible(value.type))) {
- _context16.next = 16;
- break;
- }
- if (!(!_util_config__WEBPACK_IMPORTED_MODULE_19__.Config.enable_type_casting || !_store_store__WEBPACK_IMPORTED_MODULE_5__.Store.canImplicitTypeCast(funcType, value.type))) {
- _context16.next = 15;
- break;
- }
- stringInfo = funcType.stringInfo();
- info = stringInfo[0];
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.invalid_return_type_full(funcName, info.type, info.dim, cmd.sourceInfo);
- case 15:
- real_value = _store_store__WEBPACK_IMPORTED_MODULE_5__.Store.doImplicitCasting(funcType, value);
- case 16:
- store.insertStore("$", real_value);
- store.mode = _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.RETURN;
- return _context16.abrupt("return", store);
- case 19:
- case "end":
- return _context16.stop();
- }
- }
- }, _callee16, this);
- }));
- function executeReturn(_x37, _x38) {
- return _executeReturn.apply(this, arguments);
- }
- return executeReturn;
- }()
- /**
- *
- * @param {Store} store
- * @param {Commands.Break} cmd
- *
- * @returns {Promise<Store>}
- */
- }, {
- key: "executeBreak",
- value: function () {
- 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) {
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee17$(_context17) {
- while (1) {
- switch (_context17.prev = _context17.next) {
- case 0:
- if (!this.checkContext(_context__WEBPACK_IMPORTED_MODULE_7__.Context.BREAKABLE)) {
- _context17.next = 5;
- break;
- }
- store.mode = _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.BREAK;
- return _context17.abrupt("return", store);
- case 5:
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.unexpected_break_command_full(cmd.sourceInfo);
- case 6:
- case "end":
- return _context17.stop();
- }
- }
- }, _callee17, this);
- }));
- function executeBreak(_x39, _x40) {
- return _executeBreak.apply(this, arguments);
- }
- return executeBreak;
- }()
- /**
- *
- * @param {Store} store
- * @param {Commands.Assign} cmd
- *
- * @returns {Promise<Store>}
- */
- }, {
- key: "executeAssign",
- value: function () {
- 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) {
- var inStore, value, realValue, stringInfo, info, exp_type_string_info, exp_type_info, exp, columns, _exp;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee18$(_context18) {
- while (1) {
- switch (_context18.prev = _context18.next) {
- case 0:
- inStore = store.applyStore(cmd.id);
- if (!inStore.isConst) {
- _context18.next = 3;
- break;
- }
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.invalid_const_assignment_full(cmd.id, cmd.sourceInfo);
- case 3:
- _context18.next = 5;
- return this.evaluateExpression(store, cmd.expression);
- case 5:
- value = _context18.sent;
- realValue = value;
- if (inStore.type.isCompatible(realValue.type)) {
- _context18.next = 18;
- break;
- }
- if (!(_util_config__WEBPACK_IMPORTED_MODULE_19__.Config.enable_type_casting && _store_store__WEBPACK_IMPORTED_MODULE_5__.Store.canImplicitTypeCast(inStore.type, value.type))) {
- _context18.next = 12;
- break;
- }
- realValue = _store_store__WEBPACK_IMPORTED_MODULE_5__.Store.doImplicitCasting(inStore.type, realValue);
- _context18.next = 18;
- break;
- case 12:
- stringInfo = inStore.type.stringInfo();
- info = stringInfo[0];
- exp_type_string_info = value.type.stringInfo();
- exp_type_info = exp_type_string_info[0];
- exp = cmd.expression.toString();
- 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);
- case 18:
- if (!(inStore instanceof _store_value_array_store_value__WEBPACK_IMPORTED_MODULE_25__.ArrayStoreValue)) {
- _context18.next = 27;
- break;
- }
- columns = realValue.columns == null ? 0 : realValue.columns;
- if (!(inStore.lines !== realValue.lines || inStore.columns !== columns)) {
- _context18.next = 27;
- break;
- }
- _exp = cmd.expression.toString();
- if (!inStore.isVector()) {
- _context18.next = 26;
- break;
- }
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.invalid_vector_assignment_full(cmd.id, inStore.lines, _exp, realValue.lines, cmd.sourceInfo);
- case 26:
- 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);
- case 27:
- store.updateStore(cmd.id, realValue);
- return _context18.abrupt("return", store);
- case 29:
- case "end":
- return _context18.stop();
- }
- }
- }, _callee18, this);
- }));
- function executeAssign(_x41, _x42) {
- return _executeAssign.apply(this, arguments);
- }
- return executeAssign;
- }()
- /**
- *
- * @param {Store} store
- * @param {Commands.ArrayIndexAssign} cmd
- *
- * @returns {Promise<Store>}
- */
- }, {
- key: "executeArrayIndexAssign",
- value: function () {
- 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) {
- var mustBeArray, used_dims, lineSV, line, columnSV, column, value, actualValue, type, stringInfo, info, exp_type_string_info, exp_type_info, exp, current_value, _exp2;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee19$(_context19) {
- while (1) {
- switch (_context19.prev = _context19.next) {
- case 0:
- mustBeArray = store.applyStore(cmd.id);
- used_dims = 0;
- if (!mustBeArray.isConst) {
- _context19.next = 4;
- break;
- }
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.invalid_const_assignment_full(cmd.id, cmd.sourceInfo);
- case 4:
- if (mustBeArray.type instanceof _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_17__.ArrayType) {
- _context19.next = 6;
- break;
- }
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.invalid_array_access_full(cmd.id, cmd.sourceInfo);
- case 6:
- _context19.next = 8;
- return this.evaluateExpression(store, cmd.line);
- case 8:
- lineSV = _context19.sent;
- if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.INTEGER.isCompatible(lineSV.type)) {
- _context19.next = 11;
- break;
- }
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo);
- case 11:
- used_dims += 1;
- line = lineSV.get().toNumber();
- _context19.next = 15;
- return this.evaluateExpression(store, cmd.column);
- case 15:
- columnSV = _context19.sent;
- column = null;
- if (!(columnSV != null)) {
- _context19.next = 22;
- break;
- }
- if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.INTEGER.isCompatible(columnSV.type)) {
- _context19.next = 20;
- break;
- }
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo);
- case 20:
- column = columnSV.get().toNumber();
- used_dims += 1;
- case 22:
- _context19.next = 24;
- return this.evaluateExpression(store, cmd.expression);
- case 24:
- value = _context19.sent;
- actualValue = value;
- if (!(line >= mustBeArray.lines)) {
- _context19.next = 34;
- break;
- }
- if (!mustBeArray.isVector) {
- _context19.next = 31;
- break;
- }
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.vector_line_outbounds_full(cmd.id, line, mustBeArray.lines, cmd.sourceInfo);
- case 31:
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.matrix_line_outbounds_full(cmd.id, line, mustBeArray.lines, cmd.sourceInfo);
- case 32:
- _context19.next = 36;
- break;
- case 34:
- if (!(line < 0)) {
- _context19.next = 36;
- break;
- }
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
- case 36:
- if (!(column != null && mustBeArray.columns === 0)) {
- _context19.next = 38;
- break;
- }
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.vector_not_matrix_full(cmd.id, cmd.sourceInfo);
- case 38:
- if (!(column != null)) {
- _context19.next = 45;
- break;
- }
- if (!(column >= mustBeArray.columns)) {
- _context19.next = 43;
- break;
- }
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.matrix_column_outbounds_full(cmd.id, column, mustBeArray.columns, cmd.sourceInfo);
- case 43:
- if (!(column < 0)) {
- _context19.next = 45;
- break;
- }
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
- case 45:
- if (mustBeArray.type.canAccept(value.type, used_dims)) {
- _context19.next = 55;
- break;
- }
- if (!(!_util_config__WEBPACK_IMPORTED_MODULE_19__.Config.enable_type_casting || !_store_store__WEBPACK_IMPORTED_MODULE_5__.Store.canImplicitTypeCast(mustBeArray.type.innerType, value.type))) {
- _context19.next = 54;
- break;
- }
- type = mustBeArray.type.innerType;
- stringInfo = type.stringInfo();
- info = stringInfo[0];
- exp_type_string_info = value.type.stringInfo();
- exp_type_info = exp_type_string_info[0];
- exp = cmd.expression.toString();
- 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);
- case 54:
- actualValue = _store_store__WEBPACK_IMPORTED_MODULE_5__.Store.doImplicitCasting(mustBeArray.type.innerType, value);
- case 55:
- current_value = mustBeArray.getAt(line, column);
- if (!(current_value instanceof _store_value_array_store_value__WEBPACK_IMPORTED_MODULE_25__.ArrayStoreValue)) {
- _context19.next = 60;
- break;
- }
- if (!(current_value.lines !== actualValue.lines || current_value.columns !== actualValue.columns)) {
- _context19.next = 60;
- break;
- }
- _exp2 = cmd.expression.toString();
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.invalid_matrix_index_assign_full(cmd.id, line, current_value.lines, _exp2, actualValue.lines, cmd.sourceInfo);
- case 60:
- return _context19.abrupt("return", store.updateStoreArray(cmd.id, actualValue, line, column));
- case 61:
- case "end":
- return _context19.stop();
- }
- }
- }, _callee19, this);
- }));
- function executeArrayIndexAssign(_x43, _x44) {
- return _executeArrayIndexAssign.apply(this, arguments);
- }
- return executeArrayIndexAssign;
- }()
- /**
- *
- * @param {Store} store
- * @param {Commands.Declaration} cmd
- *
- * @returns {Promise<Store>}
- */
- }, {
- key: "executeDeclaration",
- value: function () {
- 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) {
- var temp, value, realValue, stringInfo, info, exp_type_string_info, exp_type_info, exp;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee20$(_context20) {
- while (1) {
- switch (_context20.prev = _context20.next) {
- case 0:
- if (!(cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_12__.ArrayDeclaration)) {
- _context20.next = 4;
- break;
- }
- return _context20.abrupt("return", this.executeArrayDeclaration(store, cmd));
- case 4:
- temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(cmd.type, null, null, cmd.isConst);
- if (!(cmd.initial !== null)) {
- _context20.next = 22;
- break;
- }
- _context20.next = 8;
- return this.evaluateExpression(store, cmd.initial);
- case 8:
- value = _context20.sent;
- realValue = value;
- if (value.type.isCompatible(cmd.type)) {
- _context20.next = 21;
- break;
- }
- if (!(_util_config__WEBPACK_IMPORTED_MODULE_19__.Config.enable_type_casting && _store_store__WEBPACK_IMPORTED_MODULE_5__.Store.canImplicitTypeCast(cmd.type, value.type))) {
- _context20.next = 15;
- break;
- }
- realValue = _store_store__WEBPACK_IMPORTED_MODULE_5__.Store.doImplicitCasting(cmd.type, realValue);
- _context20.next = 21;
- break;
- case 15:
- stringInfo = value.type.stringInfo();
- info = stringInfo[0];
- exp_type_string_info = value.type.stringInfo();
- exp_type_info = exp_type_string_info[0];
- exp = cmd.expression.toString();
- 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);
- case 21:
- temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(cmd.type, realValue.get(), null, cmd.isConst);
- case 22:
- store.insertStore(cmd.id, temp);
- return _context20.abrupt("return", store);
- case 24:
- case "end":
- return _context20.stop();
- }
- }
- }, _callee20, this);
- }));
- function executeDeclaration(_x45, _x46) {
- return _executeDeclaration.apply(this, arguments);
- }
- return executeDeclaration;
- }()
- /**
- *
- * @param {Store} store
- * @param {Commands.ArrayDeclaration} cmd
- *
- * @returns {Promise<Store>}
- */
- }, {
- key: "executeArrayDeclaration",
- value: function () {
- 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) {
- var linesSV, line, columnsSV, column, temp, valueList;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee21$(_context21) {
- while (1) {
- switch (_context21.prev = _context21.next) {
- case 0:
- _context21.next = 2;
- return this.evaluateExpression(store, cmd.lines);
- case 2:
- linesSV = _context21.sent;
- if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.INTEGER.isCompatible(linesSV.type)) {
- _context21.next = 5;
- break;
- }
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo);
- case 5:
- line = linesSV.get().toNumber();
- _context21.next = 8;
- return this.evaluateExpression(store, cmd.columns);
- case 8:
- columnsSV = _context21.sent;
- column = null;
- if (!(columnsSV !== null)) {
- _context21.next = 16;
- break;
- }
- if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.INTEGER.isCompatible(columnsSV.type)) {
- _context21.next = 13;
- break;
- }
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo);
- case 13:
- column = columnsSV.get().toNumber();
- if (!(column < 0)) {
- _context21.next = 16;
- break;
- }
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
- case 16:
- temp = new _store_value_array_store_value__WEBPACK_IMPORTED_MODULE_25__.ArrayStoreValue(cmd.type, [], line, column, null, cmd.isConst);
- if (!(cmd.initial !== null)) {
- _context21.next = 22;
- break;
- }
- _context21.next = 20;
- return this.evaluateArrayLiteral(store, cmd.initial, cmd.type, line, column);
- case 20:
- valueList = _context21.sent;
- temp = new _store_value_array_store_value__WEBPACK_IMPORTED_MODULE_25__.ArrayStoreValue(cmd.type, valueList, line, column, null, cmd.isConst);
- case 22:
- store.insertStore(cmd.id, temp);
- return _context21.abrupt("return", store);
- case 24:
- case "end":
- return _context21.stop();
- }
- }
- }, _callee21, this);
- }));
- function executeArrayDeclaration(_x47, _x48) {
- return _executeArrayDeclaration.apply(this, arguments);
- }
- return executeArrayDeclaration;
- }()
- /**
- *
- * @param {Store} store
- * @param {Expression} exp
- *
- * @returns {Promise<import('./store/value/istore_value').IStoreValue>}
- */
- }, {
- key: "evaluateExpression",
- value: function () {
- 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) {
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee22$(_context22) {
- while (1) {
- switch (_context22.prev = _context22.next) {
- case 0:
- this.instruction_count += 1;
- if (!(this.instruction_count % _util_config__WEBPACK_IMPORTED_MODULE_19__.Config.suspend_threshold == 0)) {
- _context22.next = 4;
- break;
- }
- _context22.next = 4;
- return _util_utils__WEBPACK_IMPORTED_MODULE_16__.sleep(3);
- case 4:
- if (!(this.mode === _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.ABORT)) {
- _context22.next = 6;
- break;
- }
- throw _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_28__.LocalizedStrings.getMessage("aborted_execution");
- case 6:
- if (!(this.instruction_count >= _util_config__WEBPACK_IMPORTED_MODULE_19__.Config.max_instruction_count)) {
- _context22.next = 8;
- break;
- }
- 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.");
- case 8:
- if (!(exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_14__.UnaryApp)) {
- _context22.next = 12;
- break;
- }
- return _context22.abrupt("return", this.evaluateUnaryApp(store, exp));
- case 12:
- if (!(exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_14__.InfixApp)) {
- _context22.next = 16;
- break;
- }
- return _context22.abrupt("return", this.evaluateInfixApp(store, exp));
- case 16:
- if (!(exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_14__.ArrayAccess)) {
- _context22.next = 20;
- break;
- }
- return _context22.abrupt("return", this.evaluateArrayAccess(store, exp));
- case 20:
- if (!(exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_14__.VariableLiteral)) {
- _context22.next = 24;
- break;
- }
- return _context22.abrupt("return", this.evaluateVariableLiteral(store, exp));
- case 24:
- if (!(exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_14__.IntLiteral)) {
- _context22.next = 28;
- break;
- }
- return _context22.abrupt("return", this.evaluateLiteral(store, exp));
- case 28:
- if (!(exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_14__.RealLiteral)) {
- _context22.next = 32;
- break;
- }
- return _context22.abrupt("return", this.evaluateLiteral(store, exp));
- case 32:
- if (!(exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_14__.BoolLiteral)) {
- _context22.next = 36;
- break;
- }
- return _context22.abrupt("return", this.evaluateLiteral(store, exp));
- case 36:
- if (!(exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_14__.StringLiteral)) {
- _context22.next = 40;
- break;
- }
- return _context22.abrupt("return", this.evaluateLiteral(store, exp));
- case 40:
- if (!(exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_14__.CharLiteral)) {
- _context22.next = 44;
- break;
- }
- return _context22.abrupt("return", this.evaluateLiteral(store, exp));
- case 44:
- if (!(exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_14__.ArrayLiteral)) {
- _context22.next = 48;
- break;
- }
- throw new Error("Internal Error: The system should not eval an array literal.");
- case 48:
- if (!(exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_14__.FunctionCall)) {
- _context22.next = 50;
- break;
- }
- return _context22.abrupt("return", this.evaluateFunctionCall(store, exp));
- case 50:
- return _context22.abrupt("return", null);
- case 51:
- case "end":
- return _context22.stop();
- }
- }
- }, _callee22, this);
- }));
- function evaluateExpression(_x49, _x50) {
- return _evaluateExpression.apply(this, arguments);
- }
- return evaluateExpression;
- }()
- }, {
- key: "evaluateFunctionCall",
- value: function () {
- 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) {
- var func, sto, val;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee23$(_context23) {
- while (1) {
- switch (_context23.prev = _context23.next) {
- case 0:
- if (!exp.isMainCall) {
- _context23.next = 2;
- break;
- }
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.void_in_expression_full(_definedFunctions__WEBPACK_IMPORTED_MODULE_10__.LanguageDefinedFunction.getMainFunctionName(), exp.sourceInfo);
- case 2:
- func = this.findFunction(exp.id);
- if (!_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.VOID.isCompatible(func.returnType)) {
- _context23.next = 5;
- break;
- }
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.void_in_expression_full(exp.id, exp.sourceInfo);
- case 5:
- if (!(this.function_call_stack.length >= _util_config__WEBPACK_IMPORTED_MODULE_19__.Config.max_call_stack)) {
- _context23.next = 7;
- break;
- }
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.exceeded_recursive_calls(exp.sourceInfo);
- case 7:
- this.function_call_stack.push(exp.sourceInfo);
- _context23.next = 10;
- return this.runFunction(func, exp.actualParameters, store);
- case 10:
- sto = _context23.sent;
- if (!(sto.mode !== _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.RETURN)) {
- _context23.next = 13;
- break;
- }
- 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);
- case 13:
- val = sto.applyStore("$");
- sto.destroy();
- this.function_call_stack.pop();
- return _context23.abrupt("return", val);
- case 17:
- case "end":
- return _context23.stop();
- }
- }
- }, _callee23, this);
- }));
- function evaluateFunctionCall(_x51, _x52) {
- return _evaluateFunctionCall.apply(this, arguments);
- }
- return evaluateFunctionCall;
- }()
- /**
- *
- * @param {Store} store
- * @param {Expressions.ArrayLiteral} exp
- * @param {ArrayType} type
- *
- * @returns {Promise<StoreValue[]>}
- */
- }, {
- key: "evaluateArrayLiteral",
- value: function () {
- 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) {
- var storeValueMatrix;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee24$(_context24) {
- while (1) {
- switch (_context24.prev = _context24.next) {
- case 0:
- if (exp.isVector) {
- _context24.next = 9;
- break;
- }
- if (!(columns == null)) {
- _context24.next = 3;
- break;
- }
- throw new Error("This should never happen: Vector cannot be initialized by a matrix");
- case 3:
- _context24.next = 5;
- return this.evaluateMatrix(store, exp, type, lines, columns);
- case 5:
- storeValueMatrix = _context24.sent;
- return _context24.abrupt("return", storeValueMatrix.reduce(function (prev, next) {
- return prev.concat(next);
- }, []));
- case 9:
- if (!(columns != null)) {
- _context24.next = 11;
- break;
- }
- throw new Error("This should never happen: Matrix cannot be initialized by a vector");
- case 11:
- return _context24.abrupt("return", this.evaluateVector(store, exp, type, lines));
- case 12:
- case "end":
- return _context24.stop();
- }
- }
- }, _callee24, this);
- }));
- function evaluateArrayLiteral(_x53, _x54, _x55, _x56, _x57) {
- return _evaluateArrayLiteral.apply(this, arguments);
- }
- return evaluateArrayLiteral;
- }()
- /**
- * Evalautes a list of literals and expression composing the vector
- * @param {Store} store
- * @param {Expressions.ArrayLiteral} exps
- * @param {ArrayType} type
- * @param {number} n_elements
- *
- * @returns {Promise<StoreValue[]>} store object list
- */
- }, {
- key: "evaluateVector",
- value: function () {
- 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) {
- var _this = this;
- var values, actualValues;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee25$(_context25) {
- while (1) {
- switch (_context25.prev = _context25.next) {
- case 0:
- values = exps.value;
- if (!(n_elements !== values.length)) {
- _context25.next = 3;
- break;
- }
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.invalid_number_elements_vector(n_elements, exps.toString(), values.length, exps.sourceInfo);
- case 3:
- _context25.next = 5;
- return Promise.all(values.map(function (exp) {
- return _this.evaluateExpression(store, exp);
- }));
- case 5:
- actualValues = _context25.sent;
- return _context25.abrupt("return", actualValues.map(function (v, index) {
- if (!type.canAccept(v.type, 1)) {
- if (!_util_config__WEBPACK_IMPORTED_MODULE_19__.Config.enable_type_casting || !_store_store__WEBPACK_IMPORTED_MODULE_5__.Store.canImplicitTypeCast(type.innerType, v.type)) {
- // const stringInfo = v.type.stringInfo();
- // const info = stringInfo[0];
- var exp_str = values[index].toString(); // TODO - fix error message
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.invalid_array_literal_type_full(exp_str, values[index].sourceInfo);
- }
- var newValue = _store_store__WEBPACK_IMPORTED_MODULE_5__.Store.doImplicitCasting(type.innerType, v);
- return newValue;
- }
- return v;
- }));
- case 7:
- case "end":
- return _context25.stop();
- }
- }
- }, _callee25);
- }));
- function evaluateVector(_x58, _x59, _x60, _x61) {
- return _evaluateVector.apply(this, arguments);
- }
- return evaluateVector;
- }()
- /**
- * Evaluates a list of array literals composing the matrix
- * @param {Store} store
- * @param {Expressions.ArrayLiteral} exps
- * @param {ArrayType} type
- *
- * @returns {Promise<StoreValue[][]>}
- */
- }, {
- key: "evaluateMatrix",
- value: function () {
- 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) {
- var _this2 = this;
- var values, vectors;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee26$(_context26) {
- while (1) {
- switch (_context26.prev = _context26.next) {
- case 0:
- values = exps.value;
- if (!(values.length !== lines)) {
- _context26.next = 3;
- break;
- }
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.invalid_number_lines_matrix(lines, exps.toString(), values.length, exps.sourceInfo);
- case 3:
- vectors = values.map(function (vector) {
- var vec_type = new _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_17__.ArrayType(type.innerType, 1);
- return _this2.evaluateVector(store, vector, vec_type, columns);
- });
- _context26.next = 6;
- return Promise.all(vectors);
- case 6:
- return _context26.abrupt("return", _context26.sent);
- case 7:
- case "end":
- return _context26.stop();
- }
- }
- }, _callee26);
- }));
- function evaluateMatrix(_x62, _x63, _x64, _x65, _x66) {
- return _evaluateMatrix.apply(this, arguments);
- }
- return evaluateMatrix;
- }()
- /**
- *
- * @param {Store} _
- * @param {import('../ast/expressions/literal').Literal} exp
- *
- * @returns {import('./store/value/istore_value').IStoreValue}
- */
- }, {
- key: "evaluateLiteral",
- value: function () {
- var _evaluateLiteral = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee27(_, exp) {
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee27$(_context27) {
- while (1) {
- switch (_context27.prev = _context27.next) {
- case 0:
- return _context27.abrupt("return", new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(exp.type, exp.value));
- case 1:
- case "end":
- return _context27.stop();
- }
- }
- }, _callee27);
- }));
- function evaluateLiteral(_x67, _x68) {
- return _evaluateLiteral.apply(this, arguments);
- }
- return evaluateLiteral;
- }()
- /**
- *
- * @param {Store} store
- * @param {Expressions.VariableLiteral} exp
- *
- * @returns {import('./store/value/istore_value').IStoreValue}
- */
- }, {
- key: "evaluateVariableLiteral",
- value: function () {
- 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) {
- var val;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee28$(_context28) {
- while (1) {
- switch (_context28.prev = _context28.next) {
- case 0:
- val = store.applyStore(exp.id);
- return _context28.abrupt("return", val);
- case 2:
- case "end":
- return _context28.stop();
- }
- }
- }, _callee28);
- }));
- function evaluateVariableLiteral(_x69, _x70) {
- return _evaluateVariableLiteral.apply(this, arguments);
- }
- return evaluateVariableLiteral;
- }()
- /**
- *
- * @param {Store} store
- * @param {Expressions.ArrayAccess} exp
- *
- * @returns {import('./store/value/istore_value').IStoreValue}
- */
- }, {
- key: "evaluateArrayAccess",
- value: function () {
- 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) {
- var mustBeArray, lineSV, line, columnSV, column, result, type, values;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee29$(_context29) {
- while (1) {
- switch (_context29.prev = _context29.next) {
- case 0:
- mustBeArray = store.getStoreObject(exp.id);
- if (mustBeArray.type instanceof _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_17__.ArrayType) {
- _context29.next = 3;
- break;
- }
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.invalid_array_access_full(exp.id, exp.sourceInfo);
- case 3:
- _context29.next = 5;
- return this.evaluateExpression(store, exp.line);
- case 5:
- lineSV = _context29.sent;
- if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.INTEGER.isCompatible(lineSV.type)) {
- _context29.next = 8;
- break;
- }
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.array_dimension_not_int_full(exp.sourceInfo);
- case 8:
- line = lineSV.get().toNumber();
- _context29.next = 11;
- return this.evaluateExpression(store, exp.column);
- case 11:
- columnSV = _context29.sent;
- column = null;
- if (!(columnSV !== null)) {
- _context29.next = 17;
- break;
- }
- if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.INTEGER.isCompatible(columnSV.type)) {
- _context29.next = 16;
- break;
- }
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.array_dimension_not_int_full(exp.sourceInfo);
- case 16:
- column = columnSV.get().toNumber();
- case 17:
- if (!(line >= mustBeArray.lines)) {
- _context29.next = 25;
- break;
- }
- if (!mustBeArray.isVector) {
- _context29.next = 22;
- break;
- }
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.vector_line_outbounds_full(exp.id, line, mustBeArray.lines, exp.sourceInfo);
- case 22:
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.matrix_line_outbounds_full(exp.id, line, mustBeArray.lines, exp.sourceInfo);
- case 23:
- _context29.next = 27;
- break;
- case 25:
- if (!(line < 0)) {
- _context29.next = 27;
- break;
- }
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.array_dimension_not_positive_full(exp.sourceInfo);
- case 27:
- if (!(column !== null && mustBeArray.columns === 0)) {
- _context29.next = 29;
- break;
- }
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.vector_not_matrix_full(exp.id, exp.sourceInfo);
- case 29:
- if (!(column !== null)) {
- _context29.next = 36;
- break;
- }
- if (!(column >= mustBeArray.columns)) {
- _context29.next = 34;
- break;
- }
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.matrix_column_outbounds_full(exp.id, column, mustBeArray.columns, exp.sourceInfo);
- case 34:
- if (!(column < 0)) {
- _context29.next = 36;
- break;
- }
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.array_dimension_not_positive_full(exp.sourceInfo);
- case 36:
- result = mustBeArray.getAt(line, column);
- type = mustBeArray.type.innerType;
- if (!Array.isArray(result)) {
- _context29.next = 43;
- break;
- }
- values = result.map(function (val, col) {
- return new _store_value_store_value_address__WEBPACK_IMPORTED_MODULE_27__.StoreValueAddress(type, val, line, col, mustBeArray.id, mustBeArray.readOnly);
- });
- 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));
- case 43:
- return _context29.abrupt("return", new _store_value_store_value_address__WEBPACK_IMPORTED_MODULE_27__.StoreValueAddress(type, result, line, column, mustBeArray.id, mustBeArray.readOnly));
- case 44:
- case "end":
- return _context29.stop();
- }
- }
- }, _callee29, this);
- }));
- function evaluateArrayAccess(_x71, _x72) {
- return _evaluateArrayAccess.apply(this, arguments);
- }
- return evaluateArrayAccess;
- }()
- /**
- *
- * @param {Store} store
- * @param {Expressions.UnaryApp} unaryApp
- *
- * @returns {import('./store/value/istore_value').IStoreValue}
- */
- }, {
- key: "evaluateUnaryApp",
- value: function () {
- 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) {
- var left, resultType, stringInfo, info;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee30$(_context30) {
- while (1) {
- switch (_context30.prev = _context30.next) {
- case 0:
- _context30.next = 2;
- return this.evaluateExpression(store, unaryApp.left);
- case 2:
- left = _context30.sent;
- resultType = (0,_compatibilityTable__WEBPACK_IMPORTED_MODULE_11__.resultTypeAfterUnaryOp)(unaryApp.op, left.type);
- if (!_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.UNDEFINED.isCompatible(resultType)) {
- _context30.next = 8;
- break;
- }
- stringInfo = left.type.stringInfo();
- info = stringInfo[0];
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.invalid_unary_op_full(unaryApp.op, info.type, info.dim, unaryApp.sourceInfo);
- case 8:
- _context30.t0 = unaryApp.op.ord;
- _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;
- break;
- case 11:
- return _context30.abrupt("return", new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(resultType, left.get()));
- case 12:
- return _context30.abrupt("return", new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(resultType, left.get().negated()));
- case 13:
- return _context30.abrupt("return", new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(resultType, !left.get()));
- case 14:
- throw new _error_runtimeError__WEBPACK_IMPORTED_MODULE_21__.RuntimeError("!!!Critical Invalid UnaryApp " + unaryApp.op);
- case 15:
- case "end":
- return _context30.stop();
- }
- }
- }, _callee30, this);
- }));
- function evaluateUnaryApp(_x73, _x74) {
- return _evaluateUnaryApp.apply(this, arguments);
- }
- return evaluateUnaryApp;
- }()
- /**
- *
- * @param {Store} store
- * @param {Expressions.InfixApp} infixApp
- *
- * @returns {import('./store/value/istore_value').IStoreValue}
- */
- }, {
- key: "evaluateInfixApp",
- value: function () {
- 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) {
- 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;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee31$(_context31) {
- while (1) {
- switch (_context31.prev = _context31.next) {
- case 0:
- _context31.next = 2;
- return this.evaluateExpression(store, infixApp.left);
- case 2:
- left = _context31.sent;
- _context31.next = 5;
- return this.evaluateExpression(store, infixApp.right);
- case 5:
- right = _context31.sent;
- shouldImplicitCast = false;
- resultType = (0,_compatibilityTable__WEBPACK_IMPORTED_MODULE_11__.resultTypeAfterInfixOp)(infixApp.op, left.type, right.type);
- if (!_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.UNDEFINED.isCompatible(resultType)) {
- _context31.next = 18;
- break;
- }
- if (!(_util_config__WEBPACK_IMPORTED_MODULE_19__.Config.enable_type_casting && _store_store__WEBPACK_IMPORTED_MODULE_5__.Store.canImplicitTypeCast(left.type, right.type))) {
- _context31.next = 13;
- break;
- }
- shouldImplicitCast = true;
- _context31.next = 18;
- break;
- case 13:
- stringInfoLeft = left.type.stringInfo();
- infoLeft = stringInfoLeft[0];
- stringInfoRight = right.type.stringInfo();
- infoRight = stringInfoRight[0];
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.invalid_infix_op_full(infixApp.op, infoLeft.type, infoLeft.dim, infoRight.type, infoRight.dim, infixApp.sourceInfo);
- case 18:
- result = null;
- _context31.t0 = infixApp.op.ord;
- _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;
- break;
- case 22:
- if (!_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.STRING.isCompatible(left.type)) {
- _context31.next = 27;
- break;
- }
- rightStr = (0,_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_18__.convertToString)(right.get(), right.type);
- return _context31.abrupt("return", new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(resultType, left.get() + rightStr));
- case 27:
- if (!_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.STRING.isCompatible(right.type)) {
- _context31.next = 32;
- break;
- }
- leftStr = (0,_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_18__.convertToString)(left.get(), left.type);
- return _context31.abrupt("return", new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(resultType, leftStr + right.get()));
- case 32:
- if (!_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.CHAR.isCompatible(left.type)) {
- _context31.next = 38;
- break;
- }
- strLeft = (0,_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_18__.convertToString)(left.get(), left.type);
- strRight = (0,_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_18__.convertToString)(right.get(), right.type);
- return _context31.abrupt("return", new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(resultType, strLeft + strRight));
- case 38:
- return _context31.abrupt("return", new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(resultType, left.get().plus(right.get())));
- case 39:
- return _context31.abrupt("return", new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(resultType, left.get().minus(right.get())));
- case 40:
- result = left.get().times(right.get());
- return _context31.abrupt("return", new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(resultType, result));
- case 42:
- if (!(right.get() == 0)) {
- _context31.next = 44;
- break;
- }
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.divsion_by_zero_full(infixApp.toString(), infixApp.sourceInfo);
- case 44:
- if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.INTEGER.isCompatible(resultType)) result = left.get().divToInt(right.get());else result = left.get().div(right.get());
- return _context31.abrupt("return", new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(resultType, result));
- case 46:
- leftValue = left.get();
- rightValue = right.get();
- if (shouldImplicitCast) {
- resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.INTEGER;
- leftValue = leftValue.trunc();
- rightValue = rightValue.trunc();
- }
- result = leftValue.modulo(rightValue);
- return _context31.abrupt("return", new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(resultType, result));
- case 51:
- _leftValue = left.get();
- _rightValue = right.get();
- if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.STRING.isCompatible(left.type)) {
- result = _leftValue.length > _rightValue.length;
- } else if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.CHAR.isCompatible(left.type)) {
- result = _leftValue.charCodeAt(0) > _rightValue.charCodeAt(0);
- } else {
- if (shouldImplicitCast) {
- resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.BOOLEAN;
- _leftValue = _leftValue.trunc();
- _rightValue = _rightValue.trunc();
- }
- result = _leftValue.gt(_rightValue);
- }
- return _context31.abrupt("return", new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(resultType, result));
- case 55:
- _leftValue2 = left.get();
- _rightValue2 = right.get();
- if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.STRING.isCompatible(left.type)) {
- result = _leftValue2.length >= _rightValue2.length;
- } else if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.CHAR.isCompatible(left.type)) {
- result = _leftValue2.charCodeAt(0) >= _rightValue2.charCodeAt(0);
- } else {
- if (shouldImplicitCast) {
- resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.BOOLEAN;
- _leftValue2 = _leftValue2.trunc();
- _rightValue2 = _rightValue2.trunc();
- }
- result = _leftValue2.gte(_rightValue2);
- }
- return _context31.abrupt("return", new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(resultType, result));
- case 59:
- _leftValue3 = left.get();
- _rightValue3 = right.get();
- if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.STRING.isCompatible(left.type)) {
- result = _leftValue3.length < _rightValue3.length;
- } else if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.CHAR.isCompatible(left.type)) {
- result = _leftValue3.charCodeAt(0) < _rightValue3.charCodeAt(0);
- } else {
- if (shouldImplicitCast) {
- resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.BOOLEAN;
- _leftValue3 = _leftValue3.trunc();
- _rightValue3 = _rightValue3.trunc();
- }
- result = _leftValue3.lt(_rightValue3);
- }
- return _context31.abrupt("return", new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(resultType, result));
- case 63:
- _leftValue4 = left.get();
- _rightValue4 = right.get();
- if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.STRING.isCompatible(left.type)) {
- result = _leftValue4.length <= _rightValue4.length;
- } else if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.CHAR.isCompatible(left.type)) {
- result = _leftValue4.charCodeAt(0) <= _rightValue4.charCodeAt(0);
- } else {
- if (shouldImplicitCast) {
- resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.BOOLEAN;
- _leftValue4 = _leftValue4.trunc();
- _rightValue4 = _rightValue4.trunc();
- }
- result = _leftValue4.lte(_rightValue4);
- }
- return _context31.abrupt("return", new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(resultType, result));
- case 67:
- _leftValue5 = left.get();
- _rightValue5 = right.get();
- if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.INTEGER.isCompatible(left.type) || _typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.REAL.isCompatible(left.type)) {
- if (shouldImplicitCast) {
- resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.BOOLEAN;
- _leftValue5 = _leftValue5.trunc();
- _rightValue5 = _rightValue5.trunc();
- }
- result = _leftValue5.eq(_rightValue5);
- } else {
- result = _leftValue5 === _rightValue5;
- }
- return _context31.abrupt("return", new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(resultType, result));
- case 71:
- _leftValue6 = left.get();
- _rightValue6 = right.get();
- if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.INTEGER.isCompatible(left.type) || _typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.REAL.isCompatible(left.type)) {
- if (shouldImplicitCast) {
- resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.BOOLEAN;
- _leftValue6 = _leftValue6.trunc();
- _rightValue6 = _rightValue6.trunc();
- }
- result = !_leftValue6.eq(_rightValue6);
- } else {
- result = _leftValue6 !== _rightValue6;
- }
- return _context31.abrupt("return", new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(resultType, result));
- case 75:
- return _context31.abrupt("return", new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(resultType, left.get() && right.get()));
- case 76:
- return _context31.abrupt("return", new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(resultType, left.get() || right.get()));
- case 77:
- throw new _error_runtimeError__WEBPACK_IMPORTED_MODULE_21__.RuntimeError("!!!Critical Invalid InfixApp " + infixApp.op);
- case 78:
- case "end":
- return _context31.stop();
- }
- }
- }, _callee31, this);
- }));
- function evaluateInfixApp(_x75, _x76) {
- return _evaluateInfixApp.apply(this, arguments);
- }
- return evaluateInfixApp;
- }()
- }]);
- return IVProgProcessor;
- }();
- /***/ }),
- /***/ "./js/processor/lib/arrays.js":
- /*!************************************!*\
- !*** ./js/processor/lib/arrays.js ***!
- \************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "createNumElementsFun": () => (/* binding */ createNumElementsFun),
- /* harmony export */ "createMatrixLinesFun": () => (/* binding */ createMatrixLinesFun),
- /* harmony export */ "createMatrixColumnsFun": () => (/* binding */ createMatrixColumnsFun)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js");
- /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js");
- /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _ast_commands__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
- /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.ts");
- /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
- /* harmony import */ var _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../typeSystem/array_type */ "./js/typeSystem/array_type.ts");
- /* harmony import */ var _modes__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../modes */ "./js/processor/modes.ts");
- /* harmony import */ var _store_value_store_value__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../store/value/store_value */ "./js/processor/store/value/store_value.ts");
- /**
- * num_elements
- * matrix_lines
- * matrix_columns
- */
- function createNumElementsFun() {
- var numElementsFun = /*#__PURE__*/function () {
- var _ref = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee(sto, _) {
- var vector, temp;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- vector = sto.applyStore("vector");
- 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));
- sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.RETURN;
- sto.insertStore("$", temp);
- return _context.abrupt("return", sto);
- case 5:
- case "end":
- return _context.stop();
- }
- }
- }, _callee);
- }));
- return function numElementsFun(_x, _x2) {
- return _ref.apply(this, arguments);
- };
- }();
- var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.SysCall(numElementsFun)]);
- 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);
- return func;
- }
- function createMatrixLinesFun() {
- var matrixLinesFun = /*#__PURE__*/function () {
- var _ref2 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee2(sto, _) {
- var matrix, temp;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee2$(_context2) {
- while (1) {
- switch (_context2.prev = _context2.next) {
- case 0:
- matrix = sto.applyStore("matrix");
- 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));
- sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.RETURN;
- sto.insertStore("$", temp);
- return _context2.abrupt("return", sto);
- case 5:
- case "end":
- return _context2.stop();
- }
- }
- }, _callee2);
- }));
- return function matrixLinesFun(_x3, _x4) {
- return _ref2.apply(this, arguments);
- };
- }();
- var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.SysCall(matrixLinesFun)]);
- 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);
- return func;
- }
- function createMatrixColumnsFun() {
- var matrixColumnsFun = /*#__PURE__*/function () {
- var _ref3 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee3(sto, _) {
- var matrix, temp;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee3$(_context3) {
- while (1) {
- switch (_context3.prev = _context3.next) {
- case 0:
- matrix = sto.applyStore("matrix");
- 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));
- sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.RETURN;
- sto.insertStore("$", temp);
- return _context3.abrupt("return", sto);
- case 5:
- case "end":
- return _context3.stop();
- }
- }
- }, _callee3);
- }));
- return function matrixColumnsFun(_x5, _x6) {
- return _ref3.apply(this, arguments);
- };
- }();
- var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.SysCall(matrixColumnsFun)]);
- 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);
- return func;
- }
- /***/ }),
- /***/ "./js/processor/lib/io.js":
- /*!********************************!*\
- !*** ./js/processor/lib/io.js ***!
- \********************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "createOutputFun": () => (/* binding */ createOutputFun),
- /* harmony export */ "createInputFun": () => (/* binding */ createInputFun)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js");
- /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js");
- /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _ast_commands__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
- /* harmony import */ var _modes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../modes */ "./js/processor/modes.ts");
- /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
- /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.ts");
- /* harmony import */ var _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
- /* harmony import */ var _store_value_store_value__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../store/value/store_value */ "./js/processor/store/value/store_value.ts");
- function createOutputFun() {
- var writeFunction = /*#__PURE__*/function () {
- var _ref = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee(store, _) {
- var totalSV, total, i, val;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- totalSV = store.applyStore("p1.0");
- total = totalSV.get();
- for (i = 1; i < total; i += 1) {
- val = store.applyStore("p1.".concat(i));
- this.output.sendOutput(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_4__.convertToString(val.get(), val.type));
- }
- store.mode = _modes__WEBPACK_IMPORTED_MODULE_3__.Modes.RETURN;
- return _context.abrupt("return", store);
- case 5:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- return function writeFunction(_x, _x2) {
- return _ref.apply(this, arguments);
- };
- }();
- var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.SysCall(writeFunction)]);
- 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);
- return func;
- }
- function createInputFun() {
- var readFunction = /*#__PURE__*/function () {
- var _ref2 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee2(store, _) {
- var text, typeToConvert, type, result, stringInfo, realObject, arrayInfo, dim, stoValue;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee2$(_context2) {
- while (1) {
- switch (_context2.prev = _context2.next) {
- case 0:
- _context2.next = 2;
- return this.input.requestInput();
- case 2:
- text = _context2.sent;
- typeToConvert = store.applyStore("p1").type;
- type = null;
- result = null;
- _context2.prev = 6;
- if (!typeToConvert.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_5__.Types.INTEGER)) {
- _context2.next = 12;
- break;
- }
- result = _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_4__.toInt(text.trim()).trunc();
- type = _typeSystem_types__WEBPACK_IMPORTED_MODULE_5__.Types.INTEGER;
- _context2.next = 33;
- break;
- case 12:
- if (!typeToConvert.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_5__.Types.REAL)) {
- _context2.next = 17;
- break;
- }
- result = _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_4__.toReal(text.trim());
- type = _typeSystem_types__WEBPACK_IMPORTED_MODULE_5__.Types.REAL;
- _context2.next = 33;
- break;
- case 17:
- if (!typeToConvert.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_5__.Types.BOOLEAN)) {
- _context2.next = 22;
- break;
- }
- result = _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_4__.toBool(text.trim());
- type = _typeSystem_types__WEBPACK_IMPORTED_MODULE_5__.Types.BOOLEAN;
- _context2.next = 33;
- break;
- case 22:
- if (!typeToConvert.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_5__.Types.STRING)) {
- _context2.next = 27;
- break;
- }
- result = _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_4__.toString(text);
- type = _typeSystem_types__WEBPACK_IMPORTED_MODULE_5__.Types.STRING;
- _context2.next = 33;
- break;
- case 27:
- if (!typeToConvert.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_5__.Types.CHAR)) {
- _context2.next = 32;
- break;
- }
- result = _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_4__.toChar(text);
- type = _typeSystem_types__WEBPACK_IMPORTED_MODULE_5__.Types.CHAR;
- _context2.next = 33;
- break;
- case 32:
- throw new Error("!!!!Critical error: Unknown type in readFunction!!!!");
- case 33:
- _context2.next = 47;
- break;
- case 35:
- _context2.prev = 35;
- _context2.t0 = _context2["catch"](6);
- if (!(this.mode == _modes__WEBPACK_IMPORTED_MODULE_3__.Modes.ABORT)) {
- _context2.next = 40;
- break;
- }
- store.mode = _modes__WEBPACK_IMPORTED_MODULE_3__.Modes.RETURN;
- return _context2.abrupt("return", store);
- case 40:
- stringInfo = typeToConvert.stringInfo()[0];
- realObject = store.getStoreObject("p1");
- if (!(realObject.getReferenceDimension() > 0)) {
- _context2.next = 46;
- break;
- }
- arrayInfo = realObject.type.stringInfo()[0];
- dim = realObject.getReferenceDimension();
- 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());
- case 46:
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_6__.ProcessorErrorFactory.invalid_read_type(text, stringInfo.type, stringInfo.dim, realObject.getRefObj(), this.function_call_stack.pop());
- case 47:
- stoValue = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_7__.StoreValue(type, result);
- store.updateStore("p1", stoValue);
- store.mode = _modes__WEBPACK_IMPORTED_MODULE_3__.Modes.RETURN;
- return _context2.abrupt("return", store);
- case 51:
- case "end":
- return _context2.stop();
- }
- }
- }, _callee2, this, [[6, 35]]);
- }));
- return function readFunction(_x3, _x4) {
- return _ref2.apply(this, arguments);
- };
- }();
- var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.SysCall(readFunction)]);
- 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);
- return func;
- }
- /***/ }),
- /***/ "./js/processor/lib/lang.js":
- /*!**********************************!*\
- !*** ./js/processor/lib/lang.js ***!
- \**********************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "createIsRealFun": () => (/* binding */ createIsRealFun),
- /* harmony export */ "createIsIntFun": () => (/* binding */ createIsIntFun),
- /* harmony export */ "createIsBoolFun": () => (/* binding */ createIsBoolFun),
- /* harmony export */ "createCastRealFun": () => (/* binding */ createCastRealFun),
- /* harmony export */ "createCastIntFun": () => (/* binding */ createCastIntFun),
- /* harmony export */ "createCastBoolFun": () => (/* binding */ createCastBoolFun),
- /* harmony export */ "createCastStringFun": () => (/* binding */ createCastStringFun),
- /* harmony export */ "createCastCharFun": () => (/* binding */ createCastCharFun)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js");
- /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js");
- /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _ast_commands__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
- /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.ts");
- /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
- /* harmony import */ var _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../ast/ivprogParser */ "./js/ast/ivprogParser.js");
- /* harmony import */ var _ast_expressions__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../ast/expressions */ "./js/ast/expressions/index.js");
- /* harmony import */ var _modes__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../modes */ "./js/processor/modes.ts");
- /* harmony import */ var _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.ts");
- /* harmony import */ var _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
- /* harmony import */ var _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../store/value/store_value */ "./js/processor/store/value/store_value.ts");
- /**
- *
- * is_real
- * is_int
- * is_bool
- * cast_real
- * cast_int
- * cast_bool
- * cast_string
- * cast_char
- */
- function createIsRealFun() {
- var isRealFun = /*#__PURE__*/function () {
- var _ref = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee(sto, _) {
- var str, parser, result, val, temp;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- str = sto.applyStore("str");
- parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_5__.IVProgParser.createParser(str.get());
- result = false;
- try {
- val = parser.parseTerm();
- if (val instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_6__.RealLiteral) {
- result = true;
- }
- } catch (error) {// ignore
- }
- temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.BOOLEAN, result);
- sto.insertStore("$", temp);
- sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__.Modes.RETURN;
- return _context.abrupt("return", sto);
- case 8:
- case "end":
- return _context.stop();
- }
- }
- }, _callee);
- }));
- return function isRealFun(_x, _x2) {
- return _ref.apply(this, arguments);
- };
- }();
- var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.SysCall(isRealFun)]);
- 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);
- return func;
- }
- function createIsIntFun() {
- var isIntFun = /*#__PURE__*/function () {
- var _ref2 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee2(sto, _) {
- var str, parser, result, val, temp;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee2$(_context2) {
- while (1) {
- switch (_context2.prev = _context2.next) {
- case 0:
- str = sto.applyStore("str");
- parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_5__.IVProgParser.createParser(str.get());
- result = false;
- try {
- val = parser.parseTerm();
- if (val instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_6__.IntLiteral) {
- result = true;
- }
- } catch (_unused) {// ignore
- }
- temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.BOOLEAN, result);
- sto.insertStore("$", temp);
- sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__.Modes.RETURN;
- return _context2.abrupt("return", sto);
- case 8:
- case "end":
- return _context2.stop();
- }
- }
- }, _callee2);
- }));
- return function isIntFun(_x3, _x4) {
- return _ref2.apply(this, arguments);
- };
- }();
- var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.SysCall(isIntFun)]);
- 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);
- return func;
- }
- function createIsBoolFun() {
- var isBoolFun = function isBoolFun(sto, _) {
- var str = sto.applyStore("str");
- var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_5__.IVProgParser.createParser(str.get());
- var result = false;
- try {
- var val = parser.parseTerm();
- if (val instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_6__.BoolLiteral) {
- result = true;
- }
- } catch (error) {// ignore
- }
- var temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.BOOLEAN, result);
- sto.insertStore("$", temp);
- sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__.Modes.RETURN;
- return sto;
- };
- var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.SysCall(isBoolFun)]);
- 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);
- return func;
- }
- function createCastRealFun() {
- var castRealFun = /*#__PURE__*/function () {
- var _ref3 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee3(sto, _) {
- var val, value, temp, parser, result, _temp, typeStringInfoArray, typeInfo;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee3$(_context3) {
- while (1) {
- switch (_context3.prev = _context3.next) {
- case 0:
- val = sto.applyStore("val");
- value = val.get();
- _context3.t0 = val.type.ord;
- _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;
- break;
- case 5:
- value = value.toNumber();
- 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));
- sto.insertStore("$", temp);
- sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__.Modes.RETURN;
- return _context3.abrupt("return", sto);
- case 10:
- parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_5__.IVProgParser.createParser(value);
- _context3.prev = 11;
- result = parser.parseTerm();
- if (!(result instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_6__.RealLiteral)) {
- _context3.next = 18;
- break;
- }
- _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));
- sto.insertStore("$", _temp);
- sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__.Modes.RETURN;
- return _context3.abrupt("return", sto);
- case 18:
- _context3.next = 22;
- break;
- case 20:
- _context3.prev = 20;
- _context3.t1 = _context3["catch"](11);
- case 22:
- typeStringInfoArray = _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.REAL.stringInfo();
- typeInfo = typeStringInfoArray[0];
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_9__.ProcessorErrorFactory.invalid_type_conversion(value, typeInfo.type, typeInfo.dim);
- case 25:
- case "end":
- return _context3.stop();
- }
- }
- }, _callee3, null, [[11, 20]]);
- }));
- return function castRealFun(_x5, _x6) {
- return _ref3.apply(this, arguments);
- };
- }();
- var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.SysCall(castRealFun)]);
- 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);
- return func;
- }
- function createCastIntFun() {
- var castIntFun = /*#__PURE__*/function () {
- var _ref4 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee4(sto, _) {
- var val, value, temp, _temp2, parser, result, _temp3, typeStringInfoArray, typeInfo;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee4$(_context4) {
- while (1) {
- switch (_context4.prev = _context4.next) {
- case 0:
- val = sto.applyStore("val");
- value = val.get();
- _context4.t0 = val.type.ord;
- _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;
- break;
- case 5:
- value = value.toNumber();
- 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)));
- sto.insertStore("$", temp);
- sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__.Modes.RETURN;
- return _context4.abrupt("return", sto);
- case 10:
- _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)));
- sto.insertStore("$", _temp2);
- sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__.Modes.RETURN;
- return _context4.abrupt("return", sto);
- case 14:
- parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_5__.IVProgParser.createParser(value);
- _context4.prev = 15;
- result = parser.parseTerm();
- if (!(result instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_6__.IntLiteral)) {
- _context4.next = 22;
- break;
- }
- _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));
- sto.insertStore("$", _temp3);
- sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__.Modes.RETURN;
- return _context4.abrupt("return", sto);
- case 22:
- _context4.next = 26;
- break;
- case 24:
- _context4.prev = 24;
- _context4.t1 = _context4["catch"](15);
- case 26:
- typeStringInfoArray = _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.INTEGER.stringInfo();
- typeInfo = typeStringInfoArray[0];
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_9__.ProcessorErrorFactory.invalid_type_conversion(value, typeInfo.type, typeInfo.dim);
- case 29:
- case "end":
- return _context4.stop();
- }
- }
- }, _callee4, null, [[15, 24]]);
- }));
- return function castIntFun(_x7, _x8) {
- return _ref4.apply(this, arguments);
- };
- }();
- var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.SysCall(castIntFun)]);
- 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);
- return func;
- }
- function createCastBoolFun() {
- var castBoolFun = /*#__PURE__*/function () {
- var _ref5 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee5(sto, _) {
- var str, value, parser, val, temp, typeStringInfoArray, typeInfo;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee5$(_context5) {
- while (1) {
- switch (_context5.prev = _context5.next) {
- case 0:
- str = sto.applyStore("str");
- value = str.get();
- parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_5__.IVProgParser.createParser(value);
- _context5.prev = 3;
- val = parser.parseTerm();
- if (!(val instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_6__.BoolLiteral)) {
- _context5.next = 10;
- break;
- }
- temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.BOOLEAN, val.value);
- sto.insertStore("$", temp);
- sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__.Modes.RETURN;
- return _context5.abrupt("return", sto);
- case 10:
- _context5.next = 14;
- break;
- case 12:
- _context5.prev = 12;
- _context5.t0 = _context5["catch"](3);
- case 14:
- typeStringInfoArray = _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.BOOLEAN.stringInfo();
- typeInfo = typeStringInfoArray[0];
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_9__.ProcessorErrorFactory.invalid_type_conversion(value, typeInfo.type, typeInfo.dim);
- case 17:
- case "end":
- return _context5.stop();
- }
- }
- }, _callee5, null, [[3, 12]]);
- }));
- return function castBoolFun(_x9, _x10) {
- return _ref5.apply(this, arguments);
- };
- }();
- var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.SysCall(castBoolFun)]);
- 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);
- return func;
- }
- function createCastStringFun() {
- var castStringFun = /*#__PURE__*/function () {
- var _ref6 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee6(store, _) {
- var val, result, temp;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee6$(_context6) {
- while (1) {
- switch (_context6.prev = _context6.next) {
- case 0:
- val = store.applyStore("str");
- result = _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_4__.convertToString(val.get(), val.type);
- temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.STRING, result);
- store.insertStore("$", temp);
- store.mode = _modes__WEBPACK_IMPORTED_MODULE_7__.Modes.RETURN;
- return _context6.abrupt("return", store);
- case 6:
- case "end":
- return _context6.stop();
- }
- }
- }, _callee6);
- }));
- return function castStringFun(_x11, _x12) {
- return _ref6.apply(this, arguments);
- };
- }();
- var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.SysCall(castStringFun)]);
- 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);
- return func;
- }
- function createCastCharFun() {
- var castCharFun = function castCharFun(store, _) {
- var valSV = store.applyStore("charCode"); // Force the int value to the range [0, 255]
- var value = valSV.get().toNumber() & 0xff;
- var result = String.fromCharCode(value);
- var temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.CHAR, result);
- store.insertStore("$", temp);
- store.mode = _modes__WEBPACK_IMPORTED_MODULE_7__.Modes.RETURN;
- return store;
- };
- var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.SysCall(castCharFun)]);
- 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);
- return func;
- }
- /***/ }),
- /***/ "./js/processor/lib/math.js":
- /*!**********************************!*\
- !*** ./js/processor/lib/math.js ***!
- \**********************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "createSinFun": () => (/* binding */ createSinFun),
- /* harmony export */ "createCosFun": () => (/* binding */ createCosFun),
- /* harmony export */ "createTanFun": () => (/* binding */ createTanFun),
- /* harmony export */ "createSqrtFun": () => (/* binding */ createSqrtFun),
- /* harmony export */ "createPowFun": () => (/* binding */ createPowFun),
- /* harmony export */ "createLogFun": () => (/* binding */ createLogFun),
- /* harmony export */ "createAbsFun": () => (/* binding */ createAbsFun),
- /* harmony export */ "createNegateFun": () => (/* binding */ createNegateFun),
- /* harmony export */ "createInvertFun": () => (/* binding */ createInvertFun),
- /* harmony export */ "createMaxFun": () => (/* binding */ createMaxFun),
- /* harmony export */ "createMinFun": () => (/* binding */ createMinFun),
- /* harmony export */ "createRandFun": () => (/* binding */ createRandFun),
- /* harmony export */ "createSetSeedFun": () => (/* binding */ createSetSeedFun)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "./node_modules/@babel/runtime/helpers/toConsumableArray.js");
- /* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js");
- /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js");
- /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _ast_commands__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
- /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.ts");
- /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
- /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
- /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(decimal_js__WEBPACK_IMPORTED_MODULE_6__);
- /* harmony import */ var _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.ts");
- /* harmony import */ var _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../typeSystem/array_type */ "./js/typeSystem/array_type.ts");
- /* harmony import */ var _modes__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../modes */ "./js/processor/modes.ts");
- /* harmony import */ var _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../store/value/store_value */ "./js/processor/store/value/store_value.ts");
- /* harmony import */ var _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
- /**
- * sin
- * cos
- * tan
- * sqrt
- * pow
- * log
- * abs
- * negate
- * invert
- * max
- * min
- */
- function convertToRadians(degrees) {
- return degrees.times(decimal_js__WEBPACK_IMPORTED_MODULE_6__.Decimal.acos(-1)).div(180);
- }
- function createSinFun() {
- var sinFun = /*#__PURE__*/function () {
- var _ref = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee(sto, _) {
- var x, angle, result, temp;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- x = sto.applyStore('x');
- angle = x.get().mod(360);
- result = null;
- if (angle.eq(90)) {
- result = new decimal_js__WEBPACK_IMPORTED_MODULE_6__.Decimal(1);
- } else if (angle.eq(180)) {
- result = new decimal_js__WEBPACK_IMPORTED_MODULE_6__.Decimal(0);
- } else if (angle.eq(270)) {
- result = new decimal_js__WEBPACK_IMPORTED_MODULE_6__.Decimal(-1);
- } else {
- result = decimal_js__WEBPACK_IMPORTED_MODULE_6__.Decimal.sin(convertToRadians(angle));
- }
- temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.REAL, result);
- sto.insertStore("$", temp);
- sto.mode = _modes__WEBPACK_IMPORTED_MODULE_9__.Modes.RETURN;
- return _context.abrupt("return", sto);
- case 8:
- case "end":
- return _context.stop();
- }
- }
- }, _callee);
- }));
- return function sinFun(_x, _x2) {
- return _ref.apply(this, arguments);
- };
- }();
- var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.SysCall(sinFun)]);
- 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);
- return func;
- }
- function createCosFun() {
- var cosFun = /*#__PURE__*/function () {
- var _ref2 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee2(sto, _) {
- var x, angle, result, temp;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee2$(_context2) {
- while (1) {
- switch (_context2.prev = _context2.next) {
- case 0:
- x = sto.applyStore('x');
- angle = x.get().mod(360);
- result = null;
- if (angle.eq(90)) {
- result = new decimal_js__WEBPACK_IMPORTED_MODULE_6__.Decimal(0);
- } else if (angle.eq(180)) {
- result = new decimal_js__WEBPACK_IMPORTED_MODULE_6__.Decimal(-1);
- } else if (angle.eq(270)) {
- result = new decimal_js__WEBPACK_IMPORTED_MODULE_6__.Decimal(0);
- }
- result = decimal_js__WEBPACK_IMPORTED_MODULE_6__.Decimal.cos(convertToRadians(angle));
- temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.REAL, result);
- sto.insertStore("$", temp);
- sto.mode = _modes__WEBPACK_IMPORTED_MODULE_9__.Modes.RETURN;
- return _context2.abrupt("return", sto);
- case 9:
- case "end":
- return _context2.stop();
- }
- }
- }, _callee2);
- }));
- return function cosFun(_x3, _x4) {
- return _ref2.apply(this, arguments);
- };
- }();
- var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.SysCall(cosFun)]);
- 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);
- return func;
- }
- function createTanFun() {
- var tanFun = /*#__PURE__*/function () {
- var _ref3 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee3(sto, _) {
- var x, angle, result, temp;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee3$(_context3) {
- while (1) {
- switch (_context3.prev = _context3.next) {
- case 0:
- x = sto.applyStore('x');
- angle = x.get().mod(360);
- if (!(angle.eq(90) || angle.eq(270))) {
- _context3.next = 4;
- break;
- }
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_11__.ProcessorErrorFactory.undefined_tanget_value(x.get().toNumber(), this.function_call_stack.pop());
- case 4:
- result = decimal_js__WEBPACK_IMPORTED_MODULE_6__.Decimal.tan(convertToRadians(angle));
- temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.REAL, result);
- sto.insertStore("$", temp);
- sto.mode = _modes__WEBPACK_IMPORTED_MODULE_9__.Modes.RETURN;
- return _context3.abrupt("return", sto);
- case 9:
- case "end":
- return _context3.stop();
- }
- }
- }, _callee3, this);
- }));
- return function tanFun(_x5, _x6) {
- return _ref3.apply(this, arguments);
- };
- }();
- var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.SysCall(tanFun)]);
- 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);
- return func;
- }
- function createSqrtFun() {
- var sqrtFun = /*#__PURE__*/function () {
- var _ref4 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee4(sto, _) {
- var x, result, temp;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee4$(_context4) {
- while (1) {
- switch (_context4.prev = _context4.next) {
- case 0:
- x = sto.applyStore('x');
- if (!x.get().isNeg()) {
- _context4.next = 3;
- break;
- }
- return _context4.abrupt("return", Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_11__.ProcessorErrorFactory.negative_sqrt_value(this.function_call_stack.pop())));
- case 3:
- result = x.get().sqrt();
- temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.REAL, result);
- sto.insertStore("$", temp);
- sto.mode = _modes__WEBPACK_IMPORTED_MODULE_9__.Modes.RETURN;
- return _context4.abrupt("return", sto);
- case 8:
- case "end":
- return _context4.stop();
- }
- }
- }, _callee4, this);
- }));
- return function sqrtFun(_x7, _x8) {
- return _ref4.apply(this, arguments);
- };
- }();
- var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.SysCall(sqrtFun)]);
- 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);
- return func;
- }
- function createPowFun() {
- var powFun = /*#__PURE__*/function () {
- var _ref5 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee5(sto, _) {
- var x, y, result, temp;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee5$(_context5) {
- while (1) {
- switch (_context5.prev = _context5.next) {
- case 0:
- x = sto.applyStore('x');
- y = sto.applyStore('y');
- result = x.get().pow(y.get());
- temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.REAL, result);
- sto.insertStore("$", temp);
- sto.mode = _modes__WEBPACK_IMPORTED_MODULE_9__.Modes.RETURN;
- return _context5.abrupt("return", sto);
- case 7:
- case "end":
- return _context5.stop();
- }
- }
- }, _callee5);
- }));
- return function powFun(_x9, _x10) {
- return _ref5.apply(this, arguments);
- };
- }();
- var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.SysCall(powFun)]);
- 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);
- return func;
- }
- function createLogFun() {
- var logFun = /*#__PURE__*/function () {
- var _ref6 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee6(sto, _) {
- var x, result, temp;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee6$(_context6) {
- while (1) {
- switch (_context6.prev = _context6.next) {
- case 0:
- x = sto.applyStore('x');
- if (!x.get().isNegative()) {
- _context6.next = 3;
- break;
- }
- return _context6.abrupt("return", Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_11__.ProcessorErrorFactory.negative_log_value(this.function_call_stack.pop())));
- case 3:
- result = decimal_js__WEBPACK_IMPORTED_MODULE_6__.Decimal.log10(x.get());
- temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.REAL, result);
- sto.insertStore("$", temp);
- sto.mode = _modes__WEBPACK_IMPORTED_MODULE_9__.Modes.RETURN;
- return _context6.abrupt("return", sto);
- case 8:
- case "end":
- return _context6.stop();
- }
- }
- }, _callee6, this);
- }));
- return function logFun(_x11, _x12) {
- return _ref6.apply(this, arguments);
- };
- }();
- var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.SysCall(logFun)]);
- 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);
- return func;
- }
- function createAbsFun() {
- var absFun = /*#__PURE__*/function () {
- var _ref7 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee7(sto, _) {
- var x, result, temp;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee7$(_context7) {
- while (1) {
- switch (_context7.prev = _context7.next) {
- case 0:
- x = sto.applyStore('x');
- result = x.get().abs();
- temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__.StoreValue(x.type, result);
- sto.insertStore("$", temp);
- sto.mode = _modes__WEBPACK_IMPORTED_MODULE_9__.Modes.RETURN;
- return _context7.abrupt("return", sto);
- case 6:
- case "end":
- return _context7.stop();
- }
- }
- }, _callee7);
- }));
- return function absFun(_x13, _x14) {
- return _ref7.apply(this, arguments);
- };
- }();
- var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.SysCall(absFun)]);
- 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);
- return func;
- }
- function createNegateFun() {
- var negateFun = /*#__PURE__*/function () {
- var _ref8 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee8(sto, _) {
- var x, result, temp;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee8$(_context8) {
- while (1) {
- switch (_context8.prev = _context8.next) {
- case 0:
- x = sto.applyStore('x');
- result = x.get().negated();
- temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__.StoreValue(x.type, result);
- sto.insertStore("$", temp);
- sto.mode = _modes__WEBPACK_IMPORTED_MODULE_9__.Modes.RETURN;
- return _context8.abrupt("return", sto);
- case 6:
- case "end":
- return _context8.stop();
- }
- }
- }, _callee8);
- }));
- return function negateFun(_x15, _x16) {
- return _ref8.apply(this, arguments);
- };
- }();
- var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.SysCall(negateFun)]);
- 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);
- return func;
- }
- function createInvertFun() {
- var invertFun = /*#__PURE__*/function () {
- var _ref9 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee9(sto, _) {
- var x, result, temp;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee9$(_context9) {
- while (1) {
- switch (_context9.prev = _context9.next) {
- case 0:
- x = sto.applyStore('x');
- result = _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_5__.toReal(1).dividedBy(x.get());
- temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.REAL, result);
- sto.insertStore("$", temp);
- sto.mode = _modes__WEBPACK_IMPORTED_MODULE_9__.Modes.RETURN;
- return _context9.abrupt("return", sto);
- case 6:
- case "end":
- return _context9.stop();
- }
- }
- }, _callee9);
- }));
- return function invertFun(_x17, _x18) {
- return _ref9.apply(this, arguments);
- };
- }();
- var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.SysCall(invertFun)]);
- 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);
- return func;
- }
- function createMaxFun() {
- var maxFun = /*#__PURE__*/function () {
- var _ref10 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee10(sto, _) {
- var x, numbers, result, temp;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee10$(_context10) {
- while (1) {
- switch (_context10.prev = _context10.next) {
- case 0:
- x = sto.applyStore('x');
- numbers = x.get().map(function (sto_addrs) {
- return sto_addrs.get();
- });
- 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));
- temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__.StoreValue(x.type.innerType, result);
- sto.insertStore("$", temp);
- sto.mode = _modes__WEBPACK_IMPORTED_MODULE_9__.Modes.RETURN;
- return _context10.abrupt("return", sto);
- case 7:
- case "end":
- return _context10.stop();
- }
- }
- }, _callee10);
- }));
- return function maxFun(_x19, _x20) {
- return _ref10.apply(this, arguments);
- };
- }();
- 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);
- var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.SysCall(maxFun)]);
- 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);
- return func;
- }
- function createMinFun() {
- var minFun = /*#__PURE__*/function () {
- var _ref11 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee11(sto, _) {
- var x, numbers, result, temp;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee11$(_context11) {
- while (1) {
- switch (_context11.prev = _context11.next) {
- case 0:
- x = sto.applyStore('x');
- numbers = x.get().map(function (sto_addrs) {
- return sto_addrs.get();
- });
- 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));
- temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__.StoreValue(x.type.innerType, result);
- sto.insertStore("$", temp);
- sto.mode = _modes__WEBPACK_IMPORTED_MODULE_9__.Modes.RETURN;
- return _context11.abrupt("return", sto);
- case 7:
- case "end":
- return _context11.stop();
- }
- }
- }, _callee11);
- }));
- return function minFun(_x21, _x22) {
- return _ref11.apply(this, arguments);
- };
- }();
- 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);
- var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.SysCall(minFun)]);
- 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);
- return func;
- }
- var seed = Date.now();
- function createRandFun() {
- var a = 16807;
- var m = 2147483647;
- var c = 12345;
- var randFun = /*#__PURE__*/function () {
- var _ref12 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee12(sto, _) {
- var val, temp;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee12$(_context12) {
- while (1) {
- switch (_context12.prev = _context12.next) {
- case 0:
- seed = (a * seed + c) % m;
- val = seed / (m - 1);
- 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));
- sto.insertStore("$", temp);
- sto.mode = _modes__WEBPACK_IMPORTED_MODULE_9__.Modes.RETURN;
- return _context12.abrupt("return", sto);
- case 6:
- case "end":
- return _context12.stop();
- }
- }
- }, _callee12);
- }));
- return function randFun(_x23, _x24) {
- return _ref12.apply(this, arguments);
- };
- }();
- var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.SysCall(randFun)]);
- var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.Function("$rand", _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.REAL, [], block);
- return func;
- }
- function createSetSeedFun() {
- var setSeedFun = /*#__PURE__*/function () {
- var _ref13 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee13(sto, _) {
- var value;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee13$(_context13) {
- while (1) {
- switch (_context13.prev = _context13.next) {
- case 0:
- value = sto.applyStore("x");
- seed = value.get().toNumber();
- sto.mode = _modes__WEBPACK_IMPORTED_MODULE_9__.Modes.RETURN;
- return _context13.abrupt("return", sto);
- case 4:
- case "end":
- return _context13.stop();
- }
- }
- }, _callee13);
- }));
- return function setSeedFun(_x25, _x26) {
- return _ref13.apply(this, arguments);
- };
- }();
- var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.SysCall(setSeedFun)]);
- 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);
- return func;
- }
- /***/ }),
- /***/ "./js/processor/lib/strings.js":
- /*!*************************************!*\
- !*** ./js/processor/lib/strings.js ***!
- \*************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "createSubstringFun": () => (/* binding */ createSubstringFun),
- /* harmony export */ "createLengthFun": () => (/* binding */ createLengthFun),
- /* harmony export */ "createUppercaseFun": () => (/* binding */ createUppercaseFun),
- /* harmony export */ "createLowercaseFun": () => (/* binding */ createLowercaseFun),
- /* harmony export */ "createrCharAtFun": () => (/* binding */ createrCharAtFun)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js");
- /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js");
- /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _ast_commands__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
- /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.ts");
- /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
- /* harmony import */ var _modes__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../modes */ "./js/processor/modes.ts");
- /* harmony import */ var _store_value_store_value__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../store/value/store_value */ "./js/processor/store/value/store_value.ts");
- /* harmony import */ var _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
- /*
- * substring
- * length
- * uppercase
- * lowercase
- * charAt
- **/
- function createSubstringFun() {
- var substringFun = /*#__PURE__*/function () {
- var _ref = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee(sto, _) {
- var str, start, end, result, temp;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- str = sto.applyStore("str");
- start = sto.applyStore("start");
- end = sto.applyStore("end");
- result = str.get().substring(start.get(), end.get());
- temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_6__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.STRING, result);
- sto.insertStore("$", temp);
- sto.mode = _modes__WEBPACK_IMPORTED_MODULE_5__.Modes.RETURN;
- return _context.abrupt("return", sto);
- case 8:
- case "end":
- return _context.stop();
- }
- }
- }, _callee);
- }));
- return function substringFun(_x, _x2) {
- return _ref.apply(this, arguments);
- };
- }();
- var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.SysCall(substringFun)]);
- 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);
- return func;
- }
- function createLengthFun() {
- var lengthFun = /*#__PURE__*/function () {
- var _ref2 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee2(sto, _) {
- var str, temp;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee2$(_context2) {
- while (1) {
- switch (_context2.prev = _context2.next) {
- case 0:
- str = sto.applyStore("str");
- 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));
- sto.insertStore("$", temp);
- sto.mode = _modes__WEBPACK_IMPORTED_MODULE_5__.Modes.RETURN;
- return _context2.abrupt("return", sto);
- case 5:
- case "end":
- return _context2.stop();
- }
- }
- }, _callee2);
- }));
- return function lengthFun(_x3, _x4) {
- return _ref2.apply(this, arguments);
- };
- }();
- var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.SysCall(lengthFun)]);
- 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);
- return func;
- }
- function createUppercaseFun() {
- var uppercaseFun = /*#__PURE__*/function () {
- var _ref3 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee3(sto, _) {
- var str, temp;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee3$(_context3) {
- while (1) {
- switch (_context3.prev = _context3.next) {
- case 0:
- str = sto.applyStore("str");
- temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_6__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.STRING, str.get().toUpperCase());
- sto.insertStore("$", temp);
- sto.mode = _modes__WEBPACK_IMPORTED_MODULE_5__.Modes.RETURN;
- return _context3.abrupt("return", sto);
- case 5:
- case "end":
- return _context3.stop();
- }
- }
- }, _callee3);
- }));
- return function uppercaseFun(_x5, _x6) {
- return _ref3.apply(this, arguments);
- };
- }();
- var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.SysCall(uppercaseFun)]);
- 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);
- return func;
- }
- function createLowercaseFun() {
- var lowercaseFun = /*#__PURE__*/function () {
- var _ref4 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee4(sto, _) {
- var str, temp;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee4$(_context4) {
- while (1) {
- switch (_context4.prev = _context4.next) {
- case 0:
- str = sto.applyStore("str");
- temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_6__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.STRING, str.get().toLowerCase());
- sto.insertStore("$", temp);
- sto.mode = _modes__WEBPACK_IMPORTED_MODULE_5__.Modes.RETURN;
- return _context4.abrupt("return", sto);
- case 5:
- case "end":
- return _context4.stop();
- }
- }
- }, _callee4);
- }));
- return function lowercaseFun(_x7, _x8) {
- return _ref4.apply(this, arguments);
- };
- }();
- var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.SysCall(lowercaseFun)]);
- 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);
- return func;
- }
- function createrCharAtFun() {
- var charAtFun = /*#__PURE__*/function () {
- var _ref5 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee5(sto, _) {
- var str, idx, temp;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee5$(_context5) {
- while (1) {
- switch (_context5.prev = _context5.next) {
- case 0:
- str = sto.applyStore("str");
- idx = sto.applyStore("index");
- if (!(idx.get().toNumber() < 0 || idx.get().toNumber() >= str.get().length)) {
- _context5.next = 4;
- break;
- }
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_7__.ProcessorErrorFactory.invalid_string_index(idx.get().toNumber(), str.get(), this.function_call_stack.pop());
- case 4:
- 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()));
- sto.insertStore("$", temp);
- sto.mode = _modes__WEBPACK_IMPORTED_MODULE_5__.Modes.RETURN;
- return _context5.abrupt("return", sto);
- case 8:
- case "end":
- return _context5.stop();
- }
- }
- }, _callee5, this);
- }));
- return function charAtFun(_x9, _x10) {
- return _ref5.apply(this, arguments);
- };
- }();
- var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.SysCall(charAtFun)]);
- 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);
- return func;
- }
- /***/ }),
- /***/ "./js/processor/semantic/semanticAnalyser.js":
- /*!***************************************************!*\
- !*** ./js/processor/semantic/semanticAnalyser.js ***!
- \***************************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "SemanticAnalyser": () => (/* binding */ SemanticAnalyser)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
- /* harmony import */ var _definedFunctions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../definedFunctions */ "./js/processor/definedFunctions.js");
- /* harmony import */ var _ast_commands__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../ast/commands */ "./js/ast/commands/index.js");
- /* harmony import */ var _ast_expressions_expression__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./../../ast/expressions/expression */ "./js/ast/expressions/expression.js");
- /* harmony import */ var _ast_expressions__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../ast/expressions */ "./js/ast/expressions/index.js");
- /* harmony import */ var _ast_expressions_literal__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../ast/expressions/literal */ "./js/ast/expressions/literal.js");
- /* harmony import */ var _compatibilityTable__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../compatibilityTable */ "./js/processor/compatibilityTable.ts");
- /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../typeSystem/types */ "./js/typeSystem/types.ts");
- /* harmony import */ var _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../typeSystem/array_type */ "./js/typeSystem/array_type.ts");
- /* harmony import */ var _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.ts");
- /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../util/config */ "./js/util/config.ts");
- /* harmony import */ var _store_store__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../store/store */ "./js/processor/store/store.ts");
- /* harmony import */ var _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../../ast/ivprogParser */ "./js/ast/ivprogParser.js");
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
- var SemanticAnalyser = /*#__PURE__*/function () {
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(SemanticAnalyser, null, [{
- key: "analyseFromSource",
- value: function analyseFromSource(stringCode) {
- var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_14__.IVProgParser.createParser(stringCode);
- var semantic = new SemanticAnalyser(parser.parseTree());
- return semantic.analyseTree();
- }
- }]);
- function SemanticAnalyser(ast) {
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, SemanticAnalyser);
- this.ast = ast;
- this.symbolMap = null;
- this.currentFunction = null;
- }
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(SemanticAnalyser, [{
- key: "pushMap",
- value: function pushMap() {
- if (this.symbolMap === null) {
- this.symbolMap = {
- map: {},
- next: null
- };
- } else {
- var n = {
- map: {},
- next: this.symbolMap
- };
- this.symbolMap = n;
- }
- }
- }, {
- key: "popMap",
- value: function popMap() {
- if (this.symbolMap !== null) {
- this.symbolMap = this.symbolMap.next;
- }
- }
- }, {
- key: "insertSymbol",
- value: function insertSymbol(id, typeInfo) {
- this.symbolMap.map[id] = typeInfo;
- }
- }, {
- key: "findSymbol",
- value: function findSymbol(id, symbol_map) {
- if (!symbol_map.map[id]) {
- if (symbol_map.next) {
- return this.findSymbol(id, symbol_map.next);
- }
- return null;
- } else {
- return symbol_map.map[id];
- }
- }
- }, {
- key: "getMainFunction",
- value: function getMainFunction() {
- return this.ast.functions.find(function (v) {
- return v.isMain;
- });
- }
- }, {
- key: "findFunction",
- value: function findFunction(name) {
- if (name.match(/^\$.+$/)) {
- var fun = _definedFunctions__WEBPACK_IMPORTED_MODULE_3__.LanguageDefinedFunction.getFunction(name);
- if (!fun) {
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.not_implemented(name);
- }
- return fun;
- } else {
- var val = this.ast.functions.find(function (v) {
- return v.name === name;
- });
- if (!val) {
- return null;
- }
- return val;
- }
- }
- }, {
- key: "analyseTree",
- value: function analyseTree() {
- var globalVars = this.ast.global;
- this.pushMap();
- this.assertDeclarations(globalVars);
- var functions = this.ast.functions;
- var mainFunc = functions.filter(function (f) {
- return f.name === null;
- });
- if (mainFunc.length <= 0) {
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.main_missing();
- }
- for (var i = 0; i < functions.length; i++) {
- var fun = functions[i];
- this.assertFunction(fun);
- }
- return this.ast;
- }
- }, {
- key: "assertDeclarations",
- value: function assertDeclarations(list) {
- for (var i = 0; i < list.length; i++) {
- this.assertDeclaration(list[i]);
- }
- }
- }, {
- key: "assertDeclaration",
- value: function assertDeclaration(declaration) {
- if (declaration instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_4__.ArrayDeclaration) {
- this.assertArrayDeclaration(declaration);
- this.insertSymbol(declaration.id, {
- id: declaration.id,
- lines: declaration.lines,
- columns: declaration.columns,
- type: declaration.type,
- isConst: declaration.isConst
- });
- } else {
- if (declaration.initial === null) {
- this.insertSymbol(declaration.id, {
- id: declaration.id,
- type: declaration.type,
- isConst: declaration.isConst
- });
- return;
- }
- var resultType = this.evaluateExpressionType(declaration.initial);
- if (resultType instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_11__.MultiType) {
- if (!resultType.isCompatible(declaration.type)) {
- var stringInfo = declaration.type.stringInfo();
- var info = stringInfo[0];
- var result_string_info = resultType.stringInfo();
- var result_info = result_string_info[0];
- var exp = declaration.initial;
- 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);
- }
- this.insertSymbol(declaration.id, {
- id: declaration.id,
- type: declaration.type,
- isConst: declaration.isConst
- });
- } 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)) {
- var _stringInfo = declaration.type.stringInfo();
- var _info = _stringInfo[0];
- var _result_string_info = resultType.stringInfo();
- var _result_info = _result_string_info[0];
- var _exp = declaration.initial;
- 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);
- } else {
- this.insertSymbol(declaration.id, {
- id: declaration.id,
- type: declaration.type,
- isConst: declaration.isConst
- });
- }
- }
- }
- }, {
- key: "assertArrayDeclaration",
- value: function assertArrayDeclaration(declaration) {
- if (declaration.initial === null) {
- var lineType = this.evaluateExpressionType(declaration.lines);
- if (!lineType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.INTEGER)) {
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.array_dimension_not_int_full(declaration.sourceInfo);
- }
- if (declaration.columns !== null) {
- var columnType = this.evaluateExpressionType(declaration.columns);
- if (!columnType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.INTEGER)) {
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.array_dimension_not_int_full(declaration.sourceInfo);
- }
- }
- } else {
- this.evaluateArrayLiteral(declaration);
- }
- this.insertSymbol(declaration.id, {
- id: declaration.id,
- lines: declaration.lines,
- columns: declaration.columns,
- type: declaration.type
- });
- return;
- }
- }, {
- key: "evaluateExpressionType",
- value: function evaluateExpressionType(expression) {
- // TODO: Throw operator error in case type == UNDEFINED
- if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_6__.UnaryApp) {
- var op = expression.op;
- var resultType = this.evaluateExpressionType(expression.left);
- var finalResult = (0,_compatibilityTable__WEBPACK_IMPORTED_MODULE_8__.resultTypeAfterUnaryOp)(op, resultType);
- if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.UNDEFINED.isCompatible(finalResult)) {
- var stringInfo = resultType.stringInfo();
- var info = stringInfo[0];
- var expString = expression.toString();
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_unary_op_full(expString, op, info.type, info.dim, expression.sourceInfo);
- }
- return finalResult;
- } else if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_6__.InfixApp) {
- var _op = expression.op;
- var resultTypeLeft = this.evaluateExpressionType(expression.left);
- var resultTypeRight = this.evaluateExpressionType(expression.right);
- var _finalResult = (0,_compatibilityTable__WEBPACK_IMPORTED_MODULE_8__.resultTypeAfterInfixOp)(_op, resultTypeLeft, resultTypeRight);
- if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.UNDEFINED.isCompatible(_finalResult)) {
- var stringInfoLeft = resultTypeLeft.stringInfo();
- var infoLeft = stringInfoLeft[0];
- var stringInfoRight = resultTypeRight.stringInfo();
- var infoRight = stringInfoRight[0];
- var _expString = expression.toString();
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_infix_op_full(_expString, _op, infoLeft.type, infoLeft.dim, infoRight.type, infoRight.dim, expression.sourceInfo);
- }
- return _finalResult;
- } else if (expression instanceof _ast_expressions_literal__WEBPACK_IMPORTED_MODULE_7__.Literal) {
- return this.evaluateLiteralType(expression);
- } else if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_6__.FunctionCall) {
- if (expression.isMainCall) {
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.void_in_expression_full(_definedFunctions__WEBPACK_IMPORTED_MODULE_3__.LanguageDefinedFunction.getMainFunctionName(), expression.sourceInfo);
- }
- var fun = this.findFunction(expression.id);
- if (fun === null) {
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.function_missing_full(expression.id, expression.sourceInfo);
- }
- if (fun.returnType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.VOID)) {
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.void_in_expression_full(expression.id, expression.sourceInfo);
- }
- this.assertParameters(fun, expression.actualParameters);
- return fun.returnType;
- } else if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_6__.ArrayAccess) {
- var arrayTypeInfo = this.findSymbol(expression.id, this.symbolMap);
- if (arrayTypeInfo === null) {
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.symbol_not_found_full(expression.id, expression.sourceInfo);
- }
- if (!(arrayTypeInfo.type instanceof _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_10__.ArrayType)) {
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_array_access_full(expression.id, expression.sourceInfo);
- }
- var lineType = this.evaluateExpressionType(expression.line);
- if (!lineType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.INTEGER)) {
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.array_dimension_not_int_full(expression.sourceInfo);
- }
- if (expression.column !== null) {
- if (arrayTypeInfo.columns === null) {
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_matrix_access_full(expression.id, expression.sourceInfo);
- }
- var columnType = this.evaluateExpressionType(expression.column);
- if (!columnType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.INTEGER)) {
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.array_dimension_not_int_full(expression.sourceInfo);
- }
- }
- var arrType = arrayTypeInfo.type;
- if (expression.column !== null) {
- // indexing matrix
- return arrType.innerType;
- } else {
- if (arrayTypeInfo.columns === null) {
- return arrType.innerType;
- }
- return new _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_10__.ArrayType(arrType.innerType, 1);
- }
- }
- }
- }, {
- key: "evaluateLiteralType",
- value: function evaluateLiteralType(literal) {
- if (literal instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_6__.IntLiteral) {
- return literal.type;
- } else if (literal instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_6__.RealLiteral) {
- return literal.type;
- } else if (literal instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_6__.StringLiteral) {
- return literal.type;
- } else if (literal instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_6__.BoolLiteral) {
- return literal.type;
- } else if (literal instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_6__.CharLiteral) {
- return literal.type;
- } else if (literal instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_6__.VariableLiteral) {
- var typeInfo = this.findSymbol(literal.id, this.symbolMap);
- if (typeInfo === null) {
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.symbol_not_found_full(literal.id, literal.sourceInfo);
- }
- if (typeInfo.type instanceof _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_10__.ArrayType) {
- return typeInfo.type;
- }
- return typeInfo.type;
- } else {
- // console.warn("Evaluating type only for an array literal...");
- var last = null;
- if (literal.value.length === 1) {
- last = this.evaluateExpressionType(literal.value[0]);
- } else {
- for (var i = 0; i < literal.value.length; i++) {
- var e = this.evaluateExpressionType(literal.value[i]);
- if (last === null) {
- last = e;
- } else if (!last.isCompatible(e)) {
- var strInfo = last.stringInfo();
- var info = strInfo[0];
- var strExp = literal.toString();
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.incompatible_types_array_full(strExp, info.type, info.dim, literal.sourceInfo);
- }
- }
- }
- if (last instanceof _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_10__.ArrayType) {
- return new _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_10__.ArrayType(last.innerType, last.dimensions + 1);
- }
- return new _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_10__.ArrayType(last, 1);
- }
- }
- }, {
- key: "evaluateArrayLiteral",
- value: function evaluateArrayLiteral(arrayDeclaration) {
- var type = arrayDeclaration.type;
- var literal = arrayDeclaration.initial; // console.log(arrayDeclaration);
- if (arrayDeclaration.isVector) {
- this.evaluateVectorLiteralType(literal, type);
- } else {
- // TODO matrix type check
- for (var i = 0; i < literal.lines; ++i) {
- var line_literal = literal.value[i];
- this.evaluateVectorLiteralType(line_literal, new _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_10__.ArrayType(type.innerType, 1));
- }
- }
- return true;
- }
- }, {
- key: "assertFunction",
- value: function assertFunction(fun) {
- var _this = this;
- this.pushMap();
- this.currentFunction = fun;
- fun.formalParameters.forEach(function (formalParam) {
- if (formalParam.type instanceof _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_10__.ArrayType) {
- if (formalParam.type.dimensions > 1) {
- _this.insertSymbol(formalParam.id, {
- id: formalParam.id,
- lines: -1,
- columns: -1,
- type: formalParam.type
- });
- } else {
- _this.insertSymbol(formalParam.id, {
- id: formalParam.id,
- lines: -1,
- columns: null,
- type: formalParam.type
- });
- }
- } else {
- _this.insertSymbol(formalParam.id, {
- id: formalParam.id,
- type: formalParam.type
- });
- }
- });
- this.assertDeclarations(fun.variablesDeclarations);
- var optional = fun.returnType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.VOID);
- var valid = this.assertReturn(fun, optional);
- if (!valid) {
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.function_no_return(fun.name);
- }
- this.popMap();
- }
- }, {
- key: "assertReturn",
- value: function assertReturn(fun, optional) {
- var _this2 = this;
- return fun.commands.reduce(function (last, next) {
- return _this2.checkCommand(fun.returnType, next, optional) || last;
- }, optional);
- }
- }, {
- key: "checkCommand",
- value: function checkCommand(type, cmd, optional) {
- if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_4__.While) {
- var resultType = this.evaluateExpressionType(cmd.expression);
- if (!resultType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.BOOLEAN)) {
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.loop_condition_type_full(cmd.expression.toString(), cmd.sourceInfo);
- }
- this.checkCommands(type, cmd.commands, optional);
- return false;
- } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_4__.For) {
- var var_type = this.evaluateExpressionType(cmd.for_id);
- if (!var_type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.INTEGER)) {
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_for_variable(cmd.for_id, cmd.sourceInfo);
- }
- var from_type = this.evaluateExpressionType(cmd.for_from);
- if (!from_type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.INTEGER)) {
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_for_from(cmd.for_from, cmd.sourceInfo);
- }
- var to_type = this.evaluateExpressionType(cmd.for_to);
- if (!to_type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.INTEGER)) {
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_for_to(cmd.for_to, cmd.sourceInfo);
- }
- if (cmd.for_pass != null) {
- var pass_type = this.evaluateExpressionType(cmd.for_pass);
- if (!pass_type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.INTEGER)) {
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_for_pass(cmd.for_pass, cmd.sourceInfo);
- }
- }
- this.checkCommands(type, cmd.commands, optional);
- return false;
- } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_4__.Switch) {
- var sType = this.evaluateExpressionType(cmd.expression);
- var result = optional;
- var hasDefault = false;
- for (var i = 0; i < cmd.cases.length; i++) {
- var aCase = cmd.cases[i];
- if (aCase.expression !== null) {
- var caseType = this.evaluateExpressionType(aCase.expression);
- if (!sType.isCompatible(caseType)) {
- var strInfo = sType.stringInfo();
- var info = strInfo[0];
- var strExp = aCase.expression.toString();
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_case_type_full(strExp, info.type, info.dim, aCase.sourceInfo);
- }
- } else {
- hasDefault = true;
- }
- result = result && this.checkCommands(type, aCase.commands, result);
- }
- return result && hasDefault;
- } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_4__.ArrayIndexAssign) {
- // TODO - rework!!!!!
- var used_dims = 0;
- var typeInfo = this.findSymbol(cmd.id, this.symbolMap);
- if (typeInfo === null) {
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.symbol_not_found_full(cmd.id, cmd.sourceInfo);
- }
- if (typeInfo.isConst) {
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_const_assignment_full(cmd.id, cmd.sourceInfo);
- }
- if (!(typeInfo.type instanceof _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_10__.ArrayType)) {
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_array_access_full(cmd.id, cmd.sourceInfo);
- }
- var exp = cmd.expression;
- var lineExp = cmd.line;
- var lineType = this.evaluateExpressionType(lineExp);
- if (!lineType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.INTEGER)) {
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo);
- }
- used_dims += 1;
- var columnExp = cmd.column;
- if (typeInfo.columns === null && columnExp !== null) {
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_matrix_access_full(cmd.id, cmd.sourceInfo);
- } else if (columnExp !== null) {
- var columnType = this.evaluateExpressionType(columnExp);
- if (!columnType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.INTEGER)) {
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo);
- }
- used_dims += 1;
- } // exp a single value exp or an array access
- var exp_type = this.evaluateExpressionType(exp);
- var access_type = typeInfo.type;
- var compatible = false;
- var _type = access_type;
- if (exp_type instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_11__.MultiType) {
- if (access_type.dimensions - used_dims == 0) {
- _type = access_type.innerType;
- } else {
- _type = new _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_10__.ArrayType(access_type.innerType, Math.max(0, access_type.dimensions - used_dims));
- }
- compatible = exp_type.isCompatible(_type);
- } else {
- compatible = access_type.canAccept(exp_type, used_dims);
- }
- if (!compatible) {
- if (0 === access_type.dimensions - used_dims) {
- _type = access_type.innerType; // enable a valid attempt to cast real <--> integer
- }
- if (!_util_config__WEBPACK_IMPORTED_MODULE_12__.Config.enable_type_casting || !_store_store__WEBPACK_IMPORTED_MODULE_13__.Store.canImplicitTypeCast(_type, exp_type)) {
- var access_type_string_info = access_type.stringInfo();
- var access_type_info = access_type_string_info[0];
- var exp_type_string_info = exp_type.stringInfo();
- var exp_type_info = exp_type_string_info[0];
- 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);
- }
- }
- return optional;
- } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_4__.Assign) {
- // TODO - rework since there is no literal array assignment
- var _typeInfo = this.findSymbol(cmd.id, this.symbolMap);
- if (_typeInfo === null) {
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.symbol_not_found_full(cmd.id, cmd.sourceInfo);
- }
- if (_typeInfo.isConst) {
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_const_assignment_full(cmd.id, cmd.sourceInfo);
- }
- var _exp2 = cmd.expression;
- var _exp_type = this.evaluateExpressionType(_exp2);
- if (_exp_type instanceof _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_10__.ArrayType) {
- if (!(_typeInfo.type instanceof _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_10__.ArrayType)) {
- // TODO better error message
- throw new Error("Cannot assign an array to a non-array variable ");
- } // Both are arrays...
- // if both don't have same dimensions and type, cannot perform assignment
- if (!_exp_type.isCompatible(_typeInfo.type)) {
- if (_exp_type.dimensions === _typeInfo.type.dimensions && !_exp_type.innerType.isCompatible(_typeInfo.type.innerType)) {
- 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)) {
- var stringInfo = _typeInfo.type.stringInfo();
- var _info2 = stringInfo[0];
- var _exp_type_string_info = _exp_type.stringInfo();
- var _exp_type_info = _exp_type_string_info[0];
- 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);
- }
- } else {
- switch (_exp_type.dimensions) {
- case 1:
- {
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.vector_to_matrix_attr(cmd.id, _exp2.toString(), cmd.sourceInfo);
- }
- case 2:
- {
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.matrix_to_vector_attr(cmd.id, _exp2.toString(), cmd.sourceInfo);
- }
- }
- }
- }
- } else if (!_exp_type.isCompatible(_typeInfo.type)) {
- if (!_util_config__WEBPACK_IMPORTED_MODULE_12__.Config.enable_type_casting || !_store_store__WEBPACK_IMPORTED_MODULE_13__.Store.canImplicitTypeCast(_typeInfo.type, _exp_type)) {
- var _stringInfo2 = _typeInfo.type.stringInfo();
- var _info3 = _stringInfo2[0];
- var _exp_type_string_info2 = _exp_type.stringInfo();
- var _exp_type_info2 = _exp_type_string_info2[0];
- 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);
- }
- }
- return optional;
- } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_4__.Break) {
- return optional;
- } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_4__.IfThenElse) {
- var _resultType = this.evaluateExpressionType(cmd.condition);
- if (!_resultType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.BOOLEAN)) {
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.if_condition_type_full(cmd.condition.toString(), cmd.sourceInfo);
- }
- if (cmd.ifFalse instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_4__.IfThenElse) {
- return this.checkCommands(type, cmd.ifTrue.commands, optional) && this.checkCommand(type, cmd.ifFalse, optional);
- } else if (cmd.ifFalse != null) {
- return this.checkCommands(type, cmd.ifTrue.commands, optional) && this.checkCommands(type, cmd.ifFalse.commands, optional);
- } else {
- return this.checkCommands(type, cmd.ifTrue.commands, optional);
- }
- } else if (cmd instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_6__.FunctionCall) {
- var fun = null;
- if (cmd.isMainCall) {
- fun = this.getMainFunction();
- } else {
- fun = this.findFunction(cmd.id);
- }
- if (fun === null) {
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.function_missing_full(cmd.id, cmd.sourceInfo);
- }
- this.assertParameters(fun, cmd.actualParameters);
- return optional;
- } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_4__.Return) {
- var funcName = this.currentFunction.isMain ? _definedFunctions__WEBPACK_IMPORTED_MODULE_3__.LanguageDefinedFunction.getMainFunctionName() : this.currentFunction.name;
- if (cmd.expression === null && !type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.VOID)) {
- var _stringInfo3 = type.stringInfo();
- var _info4 = _stringInfo3[0];
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_void_return_full(funcName, _info4.type, _info4.dim, cmd.sourceInfo);
- } else if (cmd.expression !== null) {
- var _resultType2 = this.evaluateExpressionType(cmd.expression);
- if (!type.isCompatible(_resultType2)) {
- if (!_util_config__WEBPACK_IMPORTED_MODULE_12__.Config.enable_type_casting || !_store_store__WEBPACK_IMPORTED_MODULE_13__.Store.canImplicitTypeCast(type, _resultType2)) {
- var _stringInfo4 = type.stringInfo();
- var _info5 = _stringInfo4[0];
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_return_type_full(funcName, _info5.type, _info5.dim, cmd.sourceInfo);
- }
- }
- return true;
- } else {
- return true;
- }
- }
- }
- }, {
- key: "checkCommands",
- value: function checkCommands(type, cmds, optional) {
- var _this3 = this;
- return cmds.reduce(function (last, next) {
- return _this3.checkCommand(type, next, optional) || last;
- }, optional);
- }
- /**
- *
- * @param {import('./../../ast/commands/function').Function} fun
- * @param {Expression[]} actualParametersList
- */
- }, {
- key: "assertParameters",
- value: function assertParameters(fun, actualParametersList) {
- var parameterList = fun.formalParameters;
- if (parameterList.length > actualParametersList.length || parameterList.length !== actualParametersList.length && !fun.hasVariadic()) {
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_parameters_size_full(fun.name, actualParametersList.length, fun.formalParameters.length, null);
- }
- for (var i = 0, j = 0; i < parameterList.length && j < actualParametersList.length; i += 1, j += 1) {
- var formalParam = parameterList[i];
- if (formalParam.variadic && i + 1 !== parameterList.length) {
- throw "A function variadic parameter must be its last parameter!";
- }
- if (formalParam.variadic) {
- j = this.assertVariadicParameter(fun, formalParam, j, actualParametersList);
- } else {
- var param = actualParametersList[j];
- this.assertParameter(fun, formalParam, param);
- }
- }
- }
- }, {
- key: "evaluateVectorLiteralType",
- value: function evaluateVectorLiteralType(literal, type) {
- // console.log(literal);
- for (var i = 0; i < literal.value.length; i += 1) {
- var exp = literal.value[i];
- var expType = this.evaluateExpressionType(exp);
- var compatible = false;
- if (expType instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_11__.MultiType) {
- compatible = expType.isCompatible(type.innerType);
- } else {
- compatible = type.canAccept(expType, 1);
- }
- if (!compatible) {
- if (!_util_config__WEBPACK_IMPORTED_MODULE_12__.Config.enable_type_casting || !_store_store__WEBPACK_IMPORTED_MODULE_13__.Store.canImplicitTypeCast(type.innerType, expType)) {
- var stringInfo = type.stringInfo();
- var info = stringInfo[0];
- var result_string_info = expType.stringInfo();
- var result_info = result_string_info[0];
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.incompatible_types_full(info.type, 0, result_info.type, result_info.dim, exp.toString(), literal.sourceInfo);
- }
- }
- }
- return type;
- }
- /**
- *
- * @param {import('./../../ast/commands/function').Function} fun
- * @param {import('./../../ast/commands/formalParameter').FormalParameter} formalParam
- * @param {number} index
- * @param {Expression[]} actualParametersList
- */
- }, {
- key: "assertVariadicParameter",
- value: function assertVariadicParameter(fun, formalParam, index, actualParametersList) {
- var i;
- for (i = index; i < actualParametersList.length; i += 1) {
- this.assertParameter(fun, formalParam, actualParametersList[i]);
- }
- return i - 1;
- }
- /**
- *
- * @param {import('./../../ast/commands/function').Function} fun
- * @param {import('./../../ast/commands/formalParameter').FormalParameter} formalParam
- * @param {Expression} actualParameter
- */
- }, {
- key: "assertParameter",
- value: function assertParameter(fun, formalParam, actualParameter) {
- // const id = formalParam.id;
- if (formalParam.byRef) {
- if (actualParameter instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_6__.VariableLiteral) {
- var variable = this.findSymbol(actualParameter.id, this.symbolMap);
- if (variable.isConst) {
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_const_ref_full(fun.name, actualParameter.toString(), actualParameter.sourceInfo);
- }
- } else if (!(actualParameter instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_6__.VariableLiteral || actualParameter instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_6__.ArrayAccess)) {
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_parameter_type_full(fun.name, actualParameter.toString(), actualParameter.sourceInfo);
- }
- }
- var resultType = this.evaluateExpressionType(actualParameter);
- if (resultType instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_11__.MultiType && formalParam.type instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_11__.MultiType) {
- var shared = 0;
- for (var j = 0; j < resultType.types.length; ++j) {
- var element = resultType.types[j];
- if (formalParam.type.types.indexOf(element) !== -1) {
- shared += 1;
- }
- }
- if (shared <= 0) {
- if (_util_config__WEBPACK_IMPORTED_MODULE_12__.Config.enable_type_casting && !formalParam.byRef) {
- 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)) {
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_parameter_type_full(fun.name, actualParameter.toString(), actualParameter.sourceInfo);
- }
- }
- }
- } else if (resultType instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_11__.MultiType) {
- if (!resultType.isCompatible(formalParam.type)) {
- if (_util_config__WEBPACK_IMPORTED_MODULE_12__.Config.enable_type_casting && !formalParam.byRef) {
- 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)) {
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_parameter_type_full(fun.name, actualParameter.toString(), actualParameter.sourceInfo);
- }
- }
- }
- } else if (!formalParam.type.isCompatible(resultType)) {
- if (_util_config__WEBPACK_IMPORTED_MODULE_12__.Config.enable_type_casting && !formalParam.byRef) {
- if (!_store_store__WEBPACK_IMPORTED_MODULE_13__.Store.canImplicitTypeCast(formalParam.type, resultType)) {
- throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_parameter_type_full(fun.name, actualParameter.toString(), actualParameter.sourceInfo);
- }
- }
- }
- }
- }]);
- return SemanticAnalyser;
- }();
- /***/ }),
- /***/ "./js/runner.js":
- /*!**********************!*\
- !*** ./js/runner.js ***!
- \**********************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "runner": () => (/* binding */ runner)
- /* harmony export */ });
- /* harmony import */ var _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ast/ivprogParser */ "./js/ast/ivprogParser.js");
- /* harmony import */ var _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
- /* harmony import */ var _io_domConsole__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./io/domConsole */ "./js/io/domConsole.js");
- /* harmony import */ var _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
- /* harmony import */ var _memory_location__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./memory/location */ "./js/memory/location.ts");
- function runner() {
- // const lexer = new ivprogLexer(new InputStream(input));
- // const stream = new CommonTokenStream(lexer);
- // stream.fill();
- // let i = 1;
- // let token = null;
- // while ((token = stream.LT(i)).type !== ivprogLexer.EOF && token.type !== ivprogLexer.WHITESPACE) {
- // console.log(`${token.type}-${token.text}`);
- // console.log('\n')
- // i++;
- // }
- // const anaSin = new IVProgParser(input, ivprogLexer);
- var editor = new window.JsonEditor('#json-renderer', {});
- var domConsole = new _io_domConsole__WEBPACK_IMPORTED_MODULE_2__.DOMConsole("#console", true);
- domConsole.hide(); // proc.interpretAST().then( sto => {
- // console.log(sto.applyStore('a'));
- // }).catch(e => console.log(e));
- try {
- window.$('#btn').click(function () {
- var input = window.$('#input').val();
- var analiser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_0__.IVProgParser.createParser(input);
- try {
- analiser.fill(); //console.debug(analiser.tokenStream)
- var data = analiser.parseTree();
- var semAna = new _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_3__.SemanticAnalyser(data);
- var proc = new _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_1__.IVProgProcessor(semAna.analyseTree());
- proc.registerInput(domConsole);
- domConsole.clear();
- proc.registerOutput(domConsole);
- proc.interpretAST().then(function (sto) {
- console.log(sto);
- editor.load(sto.store);
- console.log(_memory_location__WEBPACK_IMPORTED_MODULE_4__.Location.size());
- })["catch"](function (e) {
- alert(e);
- console.log(e);
- console.log(_memory_location__WEBPACK_IMPORTED_MODULE_4__.Location.size());
- });
- } catch (error) {
- alert(error);
- console.log(error);
- console.log(_memory_location__WEBPACK_IMPORTED_MODULE_4__.Location.size());
- }
- });
- } catch (a) {
- console.log(a);
- }
- }
- /***/ }),
- /***/ "./js/services/i18nHelper.js":
- /*!***********************************!*\
- !*** ./js/services/i18nHelper.js ***!
- \***********************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "i18nHelper": () => (/* binding */ i18nHelper)
- /* harmony export */ });
- /* harmony import */ var line_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
- /* harmony import */ var _localizedStringsService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./localizedStringsService */ "./js/services/localizedStringsService.js");
- var StringTypes = line_i18n__WEBPACK_IMPORTED_MODULE_0__["default"].StringTypes;
- var i18nHelper = Object.freeze({
- i18n: function i18n(identifier) {
- var opts = identifier.split(':');
- var type = opts[0].toLowerCase();
- var id = opts[1];
- if (StringTypes.ERROR === type) {
- return _localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getError(id);
- } else if (StringTypes.MESSAGE === type) {
- return _localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getMessage(id);
- } else if (StringTypes.UI === type) {
- return _localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI(id);
- } else {
- console.warn("A string has been passed to the i18n helper function that was not in the form type:id -> " + identifier);
- return _localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getString(identifier, type);
- }
- }
- });
- /***/ }),
- /***/ "./js/services/localizedStringsService.js":
- /*!************************************************!*\
- !*** ./js/services/localizedStringsService.js ***!
- \************************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "LocalizedStrings": () => (/* binding */ LocalizedStrings),
- /* harmony export */ "getInstance": () => (/* binding */ getInstance)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
- /* harmony import */ var line_i18n__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
- /* harmony import */ var _languageService__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./languageService */ "./js/services/languageService.ts");
- /* harmony import */ var _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./../processor/definedFunctions */ "./js/processor/definedFunctions.js");
- /* harmony import */ var _i18n__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./../../i18n */ "./i18n/index.ts");
- /* harmony import */ var _ast_operators__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./../ast/operators */ "./js/ast/operators.ts");
- 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); }; }
- 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; } }
- var IVProgLocalizedStrings = /*#__PURE__*/function (_line_i18n$LocalizedS) {
- _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(IVProgLocalizedStrings, _line_i18n$LocalizedS);
- var _super = _createSuper(IVProgLocalizedStrings);
- function IVProgLocalizedStrings(langService, langsJsons) {
- var shouldListenToChange = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, IVProgLocalizedStrings);
- return _super.call(this, langService, langsJsons, shouldListenToChange);
- }
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(IVProgLocalizedStrings, [{
- key: "translateType",
- value: function translateType(type, dim) {
- var type_string = this.getUI("type_".concat(type));
- switch (dim) {
- case 0:
- return type_string;
- default:
- if (dim > 1) return this.getUI("matrix_info_string", [type_string]);else return this.getUI("vector_info_string", [type_string]);
- }
- }
- }, {
- key: "translateOp",
- value: function translateOp(op) {
- switch (op.ord) {
- case _ast_operators__WEBPACK_IMPORTED_MODULE_9__.Operators.AND.ord:
- case _ast_operators__WEBPACK_IMPORTED_MODULE_9__.Operators.OR.ord:
- case _ast_operators__WEBPACK_IMPORTED_MODULE_9__.Operators.NOT.ord:
- return this.getUI("logic_operator_".concat(op.value));
- default:
- return op.value;
- }
- }
- }, {
- key: "translateInternalFunction",
- value: function translateInternalFunction(name) {
- var category = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
- if (category == null) {
- return _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_7__.LanguageDefinedFunction.getLocalName(name);
- } else {
- return _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_7__.LanguageDefinedFunction.getLocalName("".concat(category, ".").concat(name));
- }
- }
- }]);
- return IVProgLocalizedStrings;
- }(line_i18n__WEBPACK_IMPORTED_MODULE_5__["default"].LocalizedStrings);
- var LocalizedStrings = Object.freeze(new IVProgLocalizedStrings(_languageService__WEBPACK_IMPORTED_MODULE_6__.LanguageService, _i18n__WEBPACK_IMPORTED_MODULE_8__["default"], true));
- var _instance = null;
- function getInstance() {
- if (_instance == null) {
- _instance = new IVProgLocalizedStrings(_languageService__WEBPACK_IMPORTED_MODULE_6__.LanguageService, _i18n__WEBPACK_IMPORTED_MODULE_8__["default"]);
- }
- return _instance;
- }
- /***/ }),
- /***/ "./js/services/userLog.js":
- /*!********************************!*\
- !*** ./js/services/userLog.js ***!
- \********************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "ActionTypes": () => (/* binding */ ActionTypes),
- /* harmony export */ "registerClick": () => (/* binding */ registerClick),
- /* harmony export */ "registerUserEvent": () => (/* binding */ registerUserEvent),
- /* harmony export */ "registerSystemEvent": () => (/* binding */ registerSystemEvent),
- /* harmony export */ "getLogs": () => (/* binding */ getLogs),
- /* harmony export */ "setRebuildMode": () => (/* binding */ setRebuildMode),
- /* harmony export */ "getLogsAsString": () => (/* binding */ getLogsAsString),
- /* harmony export */ "parseLogs": () => (/* binding */ parseLogs)
- /* harmony export */ });
- var clicks = [];
- var inRebuildMode = false;
- var ActionTypes = Object.freeze({
- // registerUserEvent payload:
- // (function_name, insert action)
- INSERT_FUNCTION: "INSERT_FUNCTION",
- // (function_name, remove action)
- REMOVE_FUNCTION: "REMOVE_FUNCTION",
- // (var_name,insert action, type, dim)
- INSERT_GLOBAL_VAR: "INSERT_GLOBAL_VAR",
- // (var name, remove action)
- REMOVE_GLOBAL_VAR: "REMOVE_GLOBAL_VAR",
- // (old function name, rename action, new function name)
- RENAME_FUNCTION: "RENAME_FUNCTION",
- // (old var name, rename action. new var name)
- RENAME_GLOBAL_VAR: "RENAME_GLOBAL_VAR",
- // (var name, set const action)
- SET_GLOBAL_CONST: "SET_GLOBAL_CONST",
- // (function name, change return action, type, dim)
- CHANGE_FUNCTION_RETURN: "CHANGE_FUNCTION_RETURN",
- // (var name, change type action, type, dim, rows?, columns?)
- CHANGE_GLOBAL_TYPE: "CHANGE_GLOBAL_TYPE",
- // (var name, change value action, value)
- CHANGE_GLOBAL_VALUE: "CHANGE_GLOBAL_VALUE",
- // (function name, insert param action, param varname, type, dim)
- INSERT_FUNCTION_PARAM: "INSERT_FUNCTION_PARAM",
- // (function name, remove param action, param varname)
- REMOVE_FUNCTION_PARAM: "REMOVE_FUNCTION_PARAM",
- // (function name, change param type action, type, dim)
- CHANGE_PARAM_TYPE: "CHANGE_PARAM_TYPE",
- // (function name, rename param action, old param name, new param name)
- RENAME_FUNCTION_PARAM: "RENAME_FUNCTION_PARAM",
- // (function name, insert var action, var name, type, dim)
- INSERT_FUNCTION_VAR: "INSERT_FUCNTION_VAR",
- // (function name, remove var action, var name)
- REMOVE_FUNCTION_VAR: "REMOVE_FUNCTION_VAR",
- // (function name, rename var action, old var name, new var name)
- RENAME_FUNCTION_VAR: "RENAME_FUNCTION_VAR",
- // (function name, change var type action, var name, type, dim, rows?, columns?)
- CHANGE_VAR_TYPE: "CHANGE_VAR_TYPE",
- // (function name, change var value action, var name, value)
- CHANGE_VAR_VALUE: "CHANGE_VAR_VALUE",
- // (function name, insert command action, command, path)
- INSERT_COMMAND: "INSERT_COMMAND",
- // (function name, remove command action, path)
- REMOVE_COMMAND: "REMOVE_COMMAND",
- // (function name, change command exp action, path, exp)
- CHANGE_COMMAND_EXP: "CHANGE_COMMAND_EXP",
- // (function name, change attrib exp action, path, exp)
- CHANGE_ATTRIB_EXP: "CHANGE_ATTRIB_EXP",
- // (function name, change attrib var action, path, var name, row_exp?, column_exp?)
- CHANGE_ATTRIB_VAR: "CHANGE_ATTRIB_VAR",
- // (function name, move command action, old path, new path)
- MOVE_COMMAND: "MOVE_COMMAND",
- // (function name, enter change name action, var name)
- ENTER_CHANGE_VAR_NAME: 'ENTER_CHANGE_VAR_NAME',
- // (function name, enter change value action, var name)
- ENTER_CHANGE_VAR_VALUE: 'ENTER_CHANGE_VAR_VALUE',
- // (var name, enter change name action)
- ENTER_CHANGE_GLOBAL_NAME: 'ENTER_CHANGE_GLOBAL_NAME',
- // (var name, enter change value action)
- ENTER_CHANGE_GLOBAL_VALUE: 'ENTER_CHANGE_GLOBAL_VALUE',
- // (function name, enter change name action, param name)
- ENTER_CHANGE_PARAM_NAME: 'ENTER_CHANGE_PARAM_NAME'
- });
- function registerClick(x, y, details) {
- if (inRebuildMode) {
- return;
- }
- clicks.push([x, y, Date.now(), details]);
- }
- function registerUserEvent(command, action) {
- for (var _len = arguments.length, params = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
- params[_key - 2] = arguments[_key];
- }
- registerEvent('user_event', command, action, params);
- }
- function registerSystemEvent(command, action) {
- for (var _len2 = arguments.length, params = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
- params[_key2 - 2] = arguments[_key2];
- }
- registerEvent('system_event', command, action, params);
- }
- function registerEvent(tag, command, action, params) {
- if (inRebuildMode) {
- return;
- }
- var event = {
- context: command,
- action: action,
- params: params
- };
- clicks.push([tag, Date.now(), event]);
- }
- function getLogs() {
- return clicks;
- }
- function setRebuildMode(flag) {
- inRebuildMode = flag;
- }
- function getLogsAsString() {
- return JSON.stringify(clicks);
- }
- function parseLogs(logData) {
- clicks = JSON.parse(logData);
- }
- /***/ }),
- /***/ "./js/typeSystem/parsers.js":
- /*!**********************************!*\
- !*** ./js/typeSystem/parsers.js ***!
- \**********************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "toInt": () => (/* binding */ toInt),
- /* harmony export */ "toString": () => (/* binding */ toString),
- /* harmony export */ "toChar": () => (/* binding */ toChar),
- /* harmony export */ "toReal": () => (/* binding */ toReal),
- /* harmony export */ "toBool": () => (/* binding */ toBool),
- /* harmony export */ "convertBoolToString": () => (/* binding */ convertBoolToString),
- /* harmony export */ "convertToString": () => (/* binding */ convertToString)
- /* harmony export */ });
- /* harmony import */ var _services_languageService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.ts");
- /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./js/typeSystem/types.ts");
- /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
- /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(decimal_js__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../util/config */ "./js/util/config.ts");
- function toInt(str) {
- return new (decimal_js__WEBPACK_IMPORTED_MODULE_2___default())(str);
- }
- function toString(str) {
- var value = str.replace(/^"/, "");
- value = value.replace(/"$/, "");
- value = value.replace(/\\b/g, "\b");
- value = value.replace(/\\t/g, "\t");
- value = value.replace(/\\n/g, "\n");
- value = value.replace(/\\r/g, "\r");
- value = value.replace(/\\"/g, '"');
- value = value.replace(/\\'/g, "'");
- value = value.replace(/\\\\/g, "\\");
- return value;
- }
- function toChar(str) {
- //console.debug(str, str.length);
- var value = str.replace(/^'/, "");
- value = value.replace(/'$/, "");
- value = value.replace(/\\b/g, "\b");
- value = value.replace(/\\t/g, "\t");
- value = value.replace(/\\n/g, "\n");
- value = value.replace(/\\r/g, "\r");
- value = value.replace(/\\"/g, '"');
- value = value.replace(/\\'/g, "'");
- value = value[0];
- return value;
- }
- function toReal(value) {
- return new (decimal_js__WEBPACK_IMPORTED_MODULE_2___default())(value);
- }
- function toBool(str) {
- var val = str;
- var lexer = _services_languageService__WEBPACK_IMPORTED_MODULE_0__.LanguageService.getCurrentLexer();
- if (lexer.getReservedKeys()[lexer.getRules().RK_TRUE] === val) {
- return true;
- } else if (lexer.getReservedKeys()[lexer.getRules().RK_FALSE] === val) {
- return false;
- } else {
- // TODO: better error message
- throw new Error(str + "not a valid boolean");
- }
- }
- function convertBoolToString(bool) {
- var lexer = _services_languageService__WEBPACK_IMPORTED_MODULE_0__.LanguageService.getCurrentLexer();
- var result = null;
- if (bool) {
- result = lexer.getReservedKeys()[lexer.getRules().RK_TRUE];
- } else {
- result = lexer.getReservedKeys()[lexer.getRules().RK_FALSE];
- } //console.debug(result)
- return result.replace(/'/g, "");
- }
- function convertToString(value, type) {
- switch (type.ord) {
- case _types__WEBPACK_IMPORTED_MODULE_1__.Types.INTEGER.ord:
- return value.toString();
- case _types__WEBPACK_IMPORTED_MODULE_1__.Types.REAL.ord:
- {
- if (value.dp() <= 0) {
- return value.toFixed(1);
- } else {
- return value.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_3__.Config.decimalPlaces);
- }
- }
- case _types__WEBPACK_IMPORTED_MODULE_1__.Types.BOOLEAN.ord:
- return convertBoolToString(value);
- default:
- return value;
- }
- }
- /***/ }),
- /***/ "./js/util/auto_gen_output.js":
- /*!************************************!*\
- !*** ./js/util/auto_gen_output.js ***!
- \************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "autoGenerateTestCaseOutput": () => (/* binding */ autoGenerateTestCaseOutput)
- /* harmony export */ });
- /* harmony import */ var _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
- /* harmony import */ var _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
- /* harmony import */ var _inputTest__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./inputTest */ "./js/util/inputTest.js");
- /* harmony import */ var _outputTest__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./outputTest */ "./js/util/outputTest.js");
- /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
- function autoGenerateTestCaseOutput(program_text, testCases) {
- var copyTestCases = testCases.map(function (test) {
- return Object.assign({}, test);
- });
- try {
- var program = _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_0__.SemanticAnalyser.analyseFromSource(program_text);
- var resultList = testCases.map(function (test, id) {
- var input = new _inputTest__WEBPACK_IMPORTED_MODULE_2__.InputTest(test.input);
- var output = new _outputTest__WEBPACK_IMPORTED_MODULE_3__.OutputTest();
- var exec = new _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_1__.IVProgProcessor(program);
- exec.registerInput(input);
- exec.registerOutput(output);
- return exec.interpretAST().then(function (_) {
- return {
- id: id,
- program: exec
- };
- });
- });
- return Promise.all(resultList).then(function (result_final) {
- for (var i = 0; i < result_final.length; ++i) {
- var result = result_final[i];
- var output = result.program.output.list;
- var input = result.program.input;
- if (input.index != input.inputList.length) {
- window.showAlert(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_4__.LocalizedStrings.getMessage("testcase_autogen_unused_input", [result.id + 1]));
- return Promise.resolve(false);
- }
- if (output.length == 0) {
- window.showAlert(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_4__.LocalizedStrings.getMessage("testcase_autogen_empty", [result.id + 1]));
- }
- copyTestCases[result.id].output = output;
- }
- window.outputGenerated(copyTestCases);
- return Promise.resolve(true);
- });
- } catch (error) {
- return Promise.reject(error);
- }
- }
- /***/ }),
- /***/ "./js/util/codeParser.js":
- /*!*******************************!*\
- !*** ./js/util/codeParser.js ***!
- \*******************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "parserCodeVisual": () => (/* binding */ parserCodeVisual)
- /* harmony export */ });
- /* harmony import */ var _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../visualUI/ivprog_elements */ "./js/visualUI/ivprog_elements.js");
- /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
- /* 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");
- /* harmony import */ var _visualUI_commands_generic_expression__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../visualUI/commands/generic_expression */ "./js/visualUI/commands/generic_expression.js");
- function parseBoolean(var_value, dimensions) {
- if (dimensions == 0) return var_value == _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("logic_value_true");
- if (dimensions == 1) {
- var final_array = [];
- var_value.forEach(function (el) {
- final_array.push(el == _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("logic_value_true"));
- });
- return final_array;
- }
- if (dimensions == 2) {
- var final_array = [];
- var_value.forEach(function (row) {
- var temp = [];
- row.forEach(function (el) {
- temp.push(el == _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("logic_value_true"));
- });
- final_array.push(temp);
- });
- return final_array;
- }
- }
- function parseGlobal(global_obj) {
- var new_global = new _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.Variable(global_obj.type, global_obj.name, global_obj.value);
- new_global.is_constant = global_obj.is_const;
- new_global.columns = global_obj.columns;
- new_global.dimensions = global_obj.dimension;
- new_global.rows = global_obj.rows;
- if (global_obj.type == "boolean") new_global.value = parseBoolean(global_obj.value, global_obj.dimension);
- window.program_obj.addGlobal(new_global);
- }
- function parseParameter(parameter_obj) {
- 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);
- new_parameter.value = parameter_obj.value;
- if (parameter_obj.type == "boolean" && parameter_obj.value) new_parameter.value = parseBoolean(parameter_obj.value, parameter_obj.dimension);
- return new_parameter;
- }
- function parseFunction(function_obj) {
- 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, []);
- if (!new_function.name) {
- new_function.name = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("start");
- new_function.is_main = true;
- }
- if (function_obj.parameters_list) {
- function_obj.parameters_list.forEach(function (el) {
- new_function.parameters_list.push(parseParameter(el));
- });
- }
- if (function_obj.variables_list) {
- function_obj.variables_list.forEach(function (el) {
- new_function.variables_list.push(parseParameter(el));
- });
- }
- window.program_obj.addFunction(new_function);
- }
- function parserCodeVisual() {
- var code_obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
- window.conteudo = code_obj; // Globals:
- window.program_obj.globals = [];
- code_obj.globals.forEach(parseGlobal); // Functions:
- window.program_obj.functions = [];
- code_obj.functions.forEach(parseFunction); // Commands:
- window.program_obj.functions.forEach(function (preparedFunction) {
- code_obj.functions.forEach(function (rawFunction) {
- if (preparedFunction.name == rawFunction.name || !rawFunction.name && preparedFunction.name == _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("start")) {
- preparedFunction.commands = parseCommands(rawFunction.commands, preparedFunction);
- }
- });
- });
- }
- function parseCommands(commands_block, function_obj) {
- if (Array.isArray(commands_block)) {
- var temp = [];
- commands_block.forEach(function (command) {
- temp.push(parseCommands(command, function_obj));
- });
- return temp;
- } else {
- switch (commands_block.type) {
- case _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.reader:
- return parseReader(commands_block, function_obj);
- case _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["return"]:
- return parseReturn(commands_block, function_obj);
- case _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.writer:
- return parseWriter(commands_block, function_obj);
- case _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["break"]:
- return parseBreak(commands_block, function_obj);
- case _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.comment:
- return parseComment(commands_block, function_obj);
- case _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.attribution:
- return parseAttribution(commands_block, function_obj);
- case _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.functioncall:
- return parseFunctionCall(commands_block, function_obj);
- case _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.iftrue:
- return parseIfTrue(commands_block, function_obj);
- case _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.repeatNtimes:
- return parseRepeatNTimes(commands_block, function_obj);
- case _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.whiletrue:
- return parseWhileTrue(commands_block, function_obj);
- case _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.dowhiletrue:
- return parseDoWhileTrue(commands_block, function_obj);
- case _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["switch"]:
- return parseSwitch(commands_block, function_obj);
- }
- return null;
- }
- }
- function parseReader(command, function_obj) {
- var temp = _visualUI_commands_generic_expression__WEBPACK_IMPORTED_MODULE_3__.expressionParserCodeVisual(command.variable, function_obj);
- if (Array.isArray(temp) && temp[0]) temp = temp[0];
- return new _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.Reader(temp);
- }
- function parseReturn(command, function_obj) {
- var temp = _visualUI_commands_generic_expression__WEBPACK_IMPORTED_MODULE_3__.expressionParserCodeVisual(command.expression, function_obj);
- return new _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.Return(temp);
- }
- function parseWriter(command, function_obj) {
- var temp = _visualUI_commands_generic_expression__WEBPACK_IMPORTED_MODULE_3__.expressionParserCodeVisual(command.content[0], function_obj);
- return new _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.Writer(temp, command.newLine);
- }
- function parseBreak(command, function_obj) {
- return new _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.Break();
- }
- function parseAttribution(command, function_obj) {
- var variable = _visualUI_commands_generic_expression__WEBPACK_IMPORTED_MODULE_3__.expressionParserCodeVisual(command.variable, function_obj);
- var expression = _visualUI_commands_generic_expression__WEBPACK_IMPORTED_MODULE_3__.expressionParserCodeVisual(command.expression, function_obj);
- if (Array.isArray(variable)) variable = variable[0];
- return new _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.Attribution(variable, expression);
- }
- function parseComment(command, function_obj) {
- // TODO
- return new _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.Comment(null);
- }
- function parseFunctionCall(command, function_obj) {
- var parameters = [];
- if (command.parameters_list) {
- command.parameters_list.forEach(function (el) {
- var temp = _visualUI_commands_generic_expression__WEBPACK_IMPORTED_MODULE_3__.expressionParserCodeVisual(el, function_obj);
- if (temp.content === 0) temp.content = "0";
- parameters.push(temp[0]);
- });
- }
- var function_called = _visualUI_commands_generic_expression__WEBPACK_IMPORTED_MODULE_3__.searchFunction(command.name);
- 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);
- temp.function_called = function_called;
- temp.parameters_list = parameters;
- return new _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.FunctionCall(temp, null);
- }
- function parseIfTrue(command, function_obj) {
- var expression = _visualUI_commands_generic_expression__WEBPACK_IMPORTED_MODULE_3__.expressionParserCodeVisual(command.expression, function_obj);
- var ifTrueBlock = parseCommands(command.ifTrue, function_obj);
- var ifFalseBlock = parseCommands(command.ifFalse, function_obj);
- return new _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.IfTrue(expression, ifTrueBlock, ifFalseBlock);
- }
- function parseRepeatNTimes(command, function_obj) {
- var var_attribution = _visualUI_commands_generic_expression__WEBPACK_IMPORTED_MODULE_3__.expressionParserCodeVisual(command.var_attribution, function_obj);
- var_attribution = var_attribution[0];
- var expression1 = _visualUI_commands_generic_expression__WEBPACK_IMPORTED_MODULE_3__.expressionParserCodeVisual(command.var_initial, function_obj);
- expression1 = expression1[0];
- var expression2 = _visualUI_commands_generic_expression__WEBPACK_IMPORTED_MODULE_3__.expressionParserCodeVisual(command.condition, function_obj);
- if (expression2[0].item == 'minus') {
- expression2 = expression2[1];
- expression2.content *= -1;
- } else expression2 = expression2[0];
- var var_step = _visualUI_commands_generic_expression__WEBPACK_IMPORTED_MODULE_3__.expressionParserCodeVisual(command.step_expression, function_obj);
- var commands_block = parseCommands(command.commands, function_obj);
- 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;
- 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]]);
- 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);
- }
- function parseWhileTrue(command, function_obj) {
- var expression = _visualUI_commands_generic_expression__WEBPACK_IMPORTED_MODULE_3__.expressionParserCodeVisual(command.expression, function_obj);
- var commands = parseCommands(command.commands, function_obj);
- return new _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.WhileTrue(expression, commands);
- }
- function parseDoWhileTrue(command, function_obj) {
- var expression = _visualUI_commands_generic_expression__WEBPACK_IMPORTED_MODULE_3__.expressionParserCodeVisual(command.expression, function_obj);
- var commands = parseCommands(command.commands, function_obj);
- return new _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.DoWhileTrue(expression, commands);
- }
- function parseSwitch(command, function_obj) {
- var expression = _visualUI_commands_generic_expression__WEBPACK_IMPORTED_MODULE_3__.expressionParserCodeVisual(command.expression, function_obj);
- var sc = [];
- if (command.cases) {
- command.cases.forEach(function (case_el) {
- var temp_exp = _visualUI_commands_generic_expression__WEBPACK_IMPORTED_MODULE_3__.expressionParserCodeVisual(case_el.expression, function_obj);
- var temp_commands = parseCommands(case_el.commands, function_obj);
- var temp_case = new _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.SwitchCase(temp_exp[0], temp_commands);
- sc.push(temp_case);
- });
- }
- return new _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.Switch(expression[0], sc);
- }
- /***/ }),
- /***/ "./js/util/dataProcess.js":
- /*!********************************!*\
- !*** ./js/util/dataProcess.js ***!
- \********************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "processData": () => (/* binding */ processData)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js");
- /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js");
- /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__);
- 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; } } }; }
- 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); }
- 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; }
- function processData() {
- var folderInput = document.querySelector("#folder");
- var header = ["submissionid", "file", "filesize", "timestamp", "humandate", "grade", "userid", "exerciseid"];
- function generateSubCode(algorithmInIlm) {
- window.program_obj.functions = JSON.parse(algorithmInIlm).functions;
- window.program_obj.globals = JSON.parse(algorithmInIlm).globals;
- return window.ivprogCore.generateCode();
- }
- function prepareData(map, submission) {
- if (!submission) {
- return map;
- }
- var exercID = submission["exerciseid"];
- var studentID = submission["userid"];
- var exercMap = null;
- if (map.has(exercID)) {
- exercMap = map.get(exercID);
- } else {
- exercMap = new Map();
- map.set(exercID, exercMap);
- }
- if (exercMap.has(studentID)) {
- exercMap.get(studentID).push(submission);
- } else {
- exercMap.set(studentID, [submission]);
- }
- return map;
- }
- 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() {
- var files, idx, folderName, data, csvEntries, blockExercMap, getFilePath, matrix, counter, download, getExercHeader, id;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee4$(_context4) {
- while (1) {
- switch (_context4.prev = _context4.next) {
- case 0:
- getExercHeader = function _getExercHeader(id) {
- var props = ["TES", "DES", "grade", "D/T", "timestamp"];
- return props.reduce(function (acc, prop) {
- return acc + "".concat(id, "_").concat(prop, ",");
- }, "");
- };
- download = function _download(file, text) {
- //creating an invisible element
- var element = document.createElement("a");
- element.setAttribute("href", "data:text/plain," + encodeURIComponent(text));
- element.setAttribute("download", file);
- element.innerHTML = file;
- element.classList.add("ui", "primary", "button"); // Above code is equivalent to
- // <a href="path of file" download="file name">
- document.querySelector("#downloads").appendChild(element);
- };
- files = Array.from(folderInput.files);
- idx = files.find(function (f) {
- return f.name == "index.csv";
- });
- folderName = idx.webkitRelativePath.replace(idx.name, ""); //console.debug(idx);
- //console.debug(folderName);
- _context4.next = 7;
- return idx.text();
- case 7:
- data = _context4.sent;
- //console.debug(data);
- csvEntries = data.split("\n").slice(1).filter(function (line) {
- return line.length > 0;
- }).map(function (line) {
- return line.split(",");
- }).map(function (vec) {
- var obj = {};
- vec.forEach(function (val, i) {
- return obj[header[i]] = val;
- });
- return obj;
- }); //console.debug(csvEntries);
- blockExercMap = csvEntries.reduce(prepareData, new Map()); //console.log(Array.from(blockExercMatrix.entries()));
- getFilePath = /*#__PURE__*/function () {
- var _ref2 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee(submission) {
- var path, file, text;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- path = "".concat(folderName).concat(submission["file"]);
- file = files.find(function (f) {
- return f.webkitRelativePath == path;
- });
- _context.next = 4;
- return file.text();
- case 4:
- text = _context.sent;
- return _context.abrupt("return", text);
- case 6:
- case "end":
- return _context.stop();
- }
- }
- }, _callee);
- }));
- return function getFilePath(_x) {
- return _ref2.apply(this, arguments);
- };
- }();
- matrix = {};
- counter = 0;
- blockExercMap.forEach(function (studentsMap, exercID) {
- var column = [];
- studentsMap.forEach( /*#__PURE__*/function () {
- 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) {
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee3$(_context3) {
- while (1) {
- switch (_context3.prev = _context3.next) {
- case 0:
- submissions = submissions.sort(function (a, b) {
- return parseInt(a["timestamp"]) - parseInt(b["timestamp"]);
- });
- counter++;
- submissions.forEach( /*#__PURE__*/function () {
- 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) {
- var student, previousCode, previousFile, previous, currentFile, current, currentCode, logs, event, ratio;
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee2$(_context2) {
- while (1) {
- switch (_context2.prev = _context2.next) {
- case 0:
- counter++;
- student = {};
- student["grade"] = Math.max(0, parseFloat(submission["grade"]));
- student["timestamp"] = parseInt(submission["timestamp"]);
- student["student_id"] = studentID;
- student["TES"] = 0;
- student["DES"] = 0;
- student["D/T"] = 0;
- previousCode = "";
- if (!(index > 0)) {
- _context2.next = 19;
- break;
- }
- student["TES"] = parseInt(submission["timestamp"]) - parseInt(array[index - 1]["timestamp"]);
- _context2.next = 13;
- return getFilePath(array[index - 1]);
- case 13:
- previousFile = _context2.sent;
- previous = window.ivprogCore.prepareActivityToStudentHelper(previousFile).getOrElse(1);
- if (!(previous == 1)) {
- _context2.next = 18;
- break;
- }
- console.error("A submission from ".concat(studentID, " to ").concat(exercID, " is invalid"));
- return _context2.abrupt("return");
- case 18:
- previousCode = generateSubCode(previous.algorithmInIlm);
- case 19:
- _context2.next = 21;
- return getFilePath(submission);
- case 21:
- currentFile = _context2.sent;
- current = window.ivprogCore.prepareActivityToStudentHelper(currentFile).getOrElse(2);
- if (!(current == 2)) {
- _context2.next = 26;
- break;
- }
- console.error("A submission from ".concat(studentID, " to ").concat(exercID, " is invalid"));
- return _context2.abrupt("return");
- case 26:
- currentCode = generateSubCode(current.algorithmInIlm);
- if (previousCode === "") {
- logs = JSON.parse(currentFile.split("::logs::")[1]);
- event = logs[0];
- if (event == null) {
- // empty submission
- student["TES"] = 0;
- } else if (event.length === 4) {
- student["TES"] = parseInt(submission["timestamp"]) - Math.floor(parseInt(event[2]) / 1000);
- } else {
- student["TES"] = parseInt(submission["timestamp"]) - Math.floor(parseInt(event[1]) / 1000);
- }
- }
- student["DES"] = window.ivprogCore.levenshteinDistance(previousCode, currentCode);
- ratio = student["TES"] === 0 ? 0 : student["DES"] / student["TES"];
- student["D/T"] = isNaN(ratio) ? 0 : ratio;
- column.push(student);
- counter--;
- case 33:
- case "end":
- return _context2.stop();
- }
- }
- }, _callee2);
- }));
- return function (_x4, _x5, _x6) {
- return _ref4.apply(this, arguments);
- };
- }());
- counter--;
- case 4:
- case "end":
- return _context3.stop();
- }
- }
- }, _callee3);
- }));
- return function (_x2, _x3) {
- return _ref3.apply(this, arguments);
- };
- }());
- matrix[exercID] = column;
- });
- id = setInterval(function () {
- if (counter == 0) {
- clearInterval(id);
- for (var exercID in matrix) {
- var csv = "";
- var firstLine = "student_id,";
- firstLine += getExercHeader(exercID);
- var _iterator = _createForOfIteratorHelper(matrix[exercID]),
- _step;
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- var submission = _step.value;
- csv += "".concat(submission["student_id"], ",");
- csv += "".concat(submission["TES"], ",");
- csv += "".concat(submission["DES"], ",");
- csv += "".concat(submission["grade"], ",");
- csv += "".concat(submission["D/T"], ",");
- csv += "".concat(submission["timestamp"]);
- csv += "\n";
- }
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
- download("".concat(exercID, ".csv"), "".concat(firstLine, "\n").concat(csv));
- }
- }
- }, 1000);
- case 15:
- case "end":
- return _context4.stop();
- }
- }
- }, _callee4);
- })));
- }
- /***/ }),
- /***/ "./js/util/editorMode2.js":
- /*!********************************!*\
- !*** ./js/util/editorMode2.js ***!
- \********************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "CodeEditorMode": () => (/* binding */ CodeEditorMode)
- /* harmony export */ });
- /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils */ "./js/util/utils.js");
- /**
- * Source: https://raw.githubusercontent.com/codemirror/CodeMirror/master/mode/clike/clike.js
- * @author arijn Haverbeke and others
- * @author Lucas de Souza
- * @param {CodeMirror} CodeMirror
- */
- function CodeEditorMode(CodeMirror) {
- "use strict";
- function Context(indented, column, type, info, align, prev) {
- this.indented = indented;
- this.column = column;
- this.type = type;
- this.info = info;
- this.align = align;
- this.prev = prev;
- }
- function pushContext(state, col, type, info) {
- var indent = state.indented;
- if (state.context && state.context.type == "statement" && type != "statement") indent = state.context.indented;
- return state.context = new Context(indent, col, type, info, null, state.context);
- }
- function popContext(state) {
- var t = state.context.type;
- if (t == ")" || t == "]" || t == "}") state.indented = state.context.indented;
- return state.context = state.context.prev;
- }
- function typeBefore(stream, state, pos) {
- if (state.prevToken == "variable" || state.prevToken == "type") return true;
- if (/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(stream.string.slice(0, pos))) return true;
- if (state.typeAtEndOfLine && stream.column() == stream.indentation()) return true;
- }
- function isTopScope(context) {
- for (;;) {
- if (!context || context.type == "top") return true;
- if (context.type == "}" && context.prev.info != "namespace") return false;
- context = context.prev;
- }
- }
- function contains(words, word) {
- if (typeof words === "function") {
- return words(word);
- } else {
- return Object.propertyIsEnumerable.call(words, word);
- }
- }
- function tokenComment(stream, state) {
- var maybeEnd = false,
- ch;
- while (ch = stream.next()) {
- if (ch == "/" && maybeEnd) {
- state.tokenize = null;
- break;
- }
- maybeEnd = ch == "*";
- }
- return "comment";
- }
- CodeMirror.defineMode("ivprog", function (config, parserConfig) {
- var indentUnit = config.indentUnit,
- statementIndentUnit = parserConfig.statementIndentUnit || indentUnit,
- dontAlignCalls = parserConfig.dontAlignCalls,
- keywords = parserConfig.keywords || {},
- switchKeyword = parserConfig.switchKeyword,
- caseKeyword = parserConfig.caseKeyword,
- defaultKeyword = parserConfig.defaultKeyword,
- caseRegex = new RegExp("^\\s*(?:".concat(caseKeyword, " .*?:|").concat(defaultKeyword, ":|\\{\\}?|\\})$")),
- ////,
- types = parserConfig.types || {},
- builtin = parserConfig.builtin || {},
- blockKeywords = parserConfig.blockKeywords || {},
- defKeywords = parserConfig.defKeywords || {},
- atoms = parserConfig.atoms || {},
- hooks = parserConfig.hooks || {},
- multiLineStrings = parserConfig.multiLineStrings,
- indentStatements = false,
- namespaceSeparator = null,
- isPunctuationChar = /[[\]{}(),;:\n]/,
- numberStart = /[\d.]/,
- number = /^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)$/i,
- isOperatorChar = /[+\-*%=<>!/&]/,
- isIdentifierChar = /[a-zA-Z0-9_]/,
- // An optional function that takes a {string} token and returns true if it
- // should be treated as a builtin.
- isReservedIdentifier = parserConfig.isReservedIdentifier || false;
- var curPunc, isDefKeyword;
- var tokenString = function tokenString() {
- /*SKIP*/
- };
- function tokenBase(stream, state) {
- var ch = stream.next();
- if (hooks[ch]) {
- var result = hooks[ch](stream, state);
- if (result !== false) return result;
- }
- if (ch == '"') {
- state.tokenize = tokenString(ch);
- return state.tokenize(stream, state);
- }
- if (isPunctuationChar.test(ch)) {
- curPunc = ch;
- return null;
- }
- if (numberStart.test(ch)) {
- stream.backUp(1);
- if (stream.match(number)) return "number";
- stream.next();
- }
- if (ch == "/") {
- if (stream.eat("*")) {
- state.tokenize = tokenComment;
- return tokenComment(stream, state);
- }
- if (stream.eat("/")) {
- stream.skipToEnd();
- return "comment";
- }
- }
- if (isOperatorChar.test(ch)) {
- while (!stream.match(/^\/[/*]/, false) && stream.eat(isOperatorChar)) {
- /* SKIP */
- }
- return "operator";
- }
- stream.eatWhile(isIdentifierChar);
- if (namespaceSeparator) while (stream.match(namespaceSeparator)) {
- stream.eatWhile(isIdentifierChar);
- }
- var cur = stream.current();
- if (contains(keywords, cur)) {
- if (contains(blockKeywords, cur)) curPunc = "newstatement";
- if (contains(defKeywords, cur)) isDefKeyword = true;
- return "keyword";
- }
- if (contains(types, cur)) return "type";
- if (contains(builtin, cur) || isReservedIdentifier && isReservedIdentifier(cur)) {
- if (contains(blockKeywords, cur)) curPunc = "newstatement";
- return "builtin";
- }
- if (contains(atoms, cur)) return "atom";
- return "variable";
- }
- tokenString = function tokenString(quote) {
- return function (stream, state) {
- var escaped = false,
- next,
- end = false;
- while ((next = stream.next()) != null) {
- if (next == quote && !escaped) {
- end = true;
- break;
- }
- escaped = !escaped && next == "\\";
- }
- if (end || !(escaped || multiLineStrings)) state.tokenize = null;
- return "string";
- };
- };
- function maybeEOL(stream, state) {
- if (parserConfig.typeFirstDefinitions && stream.eol() && isTopScope(state.context)) state.typeAtEndOfLine = typeBefore(stream, state, stream.pos);
- } // Interface
- return {
- startState: function startState(basecolumn) {
- return {
- tokenize: null,
- context: new Context((basecolumn || 0) - indentUnit, 0, "top", null, false),
- indented: 0,
- startOfLine: true,
- prevToken: null
- };
- },
- token: function token(stream, state) {
- var ctx = state.context;
- if (stream.sol()) {
- if (ctx.align == null) ctx.align = false;
- state.indented = stream.indentation();
- state.startOfLine = true;
- }
- if (stream.eatSpace()) {
- maybeEOL(stream, state);
- return null;
- }
- curPunc = isDefKeyword = null;
- var style = (state.tokenize || tokenBase)(stream, state);
- if (style == "comment" || style == "meta") return style;
- if (ctx.align == null) ctx.align = true;
- if (curPunc == ";" || curPunc == ":" || curPunc == "," && stream.match(/^\s*(?:\/\/.*)?$/, false)) while (state.context.type == "statement") {
- popContext(state);
- } else if (curPunc == "{") pushContext(state, stream.column(), "}");else if (curPunc == "[") pushContext(state, stream.column(), "]");else if (curPunc == "(") pushContext(state, stream.column(), ")");else if (curPunc == "}") {
- while (ctx.type == "statement") {
- ctx = popContext(state);
- }
- if (ctx.type == "}") ctx = popContext(state);
- while (ctx.type == "statement") {
- ctx = popContext(state);
- }
- } else if (curPunc == ctx.type) popContext(state);else if (indentStatements && ((ctx.type == "}" || ctx.type == "top") && curPunc != ";" || ctx.type == "statement" && curPunc == "newstatement")) {
- pushContext(state, stream.column(), "statement", stream.current());
- }
- if (style == "variable" && (state.prevToken == "def" || parserConfig.typeFirstDefinitions && typeBefore(stream, state, stream.start) && isTopScope(state.context) && stream.match(/^\s*\(/, false))) style = "def";
- if (hooks.token) {
- var result = hooks.token(stream, state, style);
- if (result !== undefined) style = result;
- }
- if (style == "def" && parserConfig.styleDefs === false) style = "variable";
- state.startOfLine = false;
- state.prevToken = isDefKeyword ? "def" : style || curPunc;
- maybeEOL(stream, state);
- return style;
- },
- indent: function indent(state, textAfter) {
- if (state.tokenize != tokenBase && state.tokenize != null || state.typeAtEndOfLine) return CodeMirror.Pass;
- var ctx = state.context;
- var firstChar = textAfter && textAfter.charAt(0);
- var closing = firstChar == ctx.type;
- if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev;
- if (parserConfig.dontIndentStatements) while (ctx.type == "statement" && parserConfig.dontIndentStatements.test(ctx.info)) {
- ctx = ctx.prev;
- }
- if (hooks.indent) {
- var hook = hooks.indent(state, ctx, textAfter, indentUnit);
- if (typeof hook == "number") return hook;
- }
- var switchBlock = ctx.prev && ctx.prev.info == switchKeyword;
- if (parserConfig.allmanIndentation && /[{(]/.test(firstChar)) {
- while (ctx.type != "top" && ctx.type != "}") {
- ctx = ctx.prev;
- }
- return ctx.indented;
- }
- if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : statementIndentUnit);
- if (ctx.align && (!dontAlignCalls || ctx.type != ")")) return ctx.column + (closing ? 0 : 1);
- if (ctx.type == ")" && !closing) return ctx.indented + statementIndentUnit;
- var caseTestRegex = new RegExp("^(?:".concat(caseKeyword, "|").concat(defaultKeyword, ")\b"));
- return ctx.indented + (closing ? 0 : indentUnit) + (!closing && switchBlock && !caseTestRegex.test(textAfter) ? indentUnit : 0);
- },
- electricInput: caseRegex,
- blockCommentStart: "/*",
- blockCommentEnd: "*/",
- blockCommentContinue: " * ",
- lineComment: "//",
- fold: "brace"
- };
- });
- function words(str) {
- var obj = {},
- words = str.split(" ");
- for (var i = 0; i < words.length; ++i) {
- obj[words[i]] = true;
- }
- return obj;
- }
- var codeConfig = (0,_utils__WEBPACK_IMPORTED_MODULE_0__.getCodeEditorModeConfig)();
- var ivprogKeywords = codeConfig.keywords.join(" ");
- var basicTypes = words(codeConfig.types.join(" "));
- function ivprogTypes(identifier) {
- return contains(basicTypes, identifier);
- }
- var ivprogBlockKeywords = codeConfig.blocks.join(" ");
- var ivprogDefKeywords = "funcao const";
- function def(mimes, mode) {
- if (typeof mimes == "string") mimes = [mimes];
- var words = [];
- function add(obj) {
- if (obj) {
- for (var prop in obj) {
- if (Object.hasOwnProperty.call(obj, prop)) {
- words.push(prop);
- }
- }
- }
- }
- add(mode.keywords);
- add(mode.types);
- add(mode.builtin);
- add(mode.atoms);
- if (words.length) {
- mode.helperType = mimes[0];
- CodeMirror.registerHelper("hintWords", mimes[0], words);
- }
- for (var i = 0; i < mimes.length; ++i) {
- CodeMirror.defineMIME(mimes[i], mode);
- }
- }
- def(["text/x-ivprog"], {
- name: "ivprog",
- keywords: words(ivprogKeywords),
- types: ivprogTypes,
- blockKeywords: words(ivprogBlockKeywords),
- defKeywords: words(ivprogDefKeywords),
- typeFirstDefinitions: true,
- atoms: words(codeConfig.atoms.join(" ")),
- switchKeyword: codeConfig.switchString,
- caseKeyword: codeConfig.case_default[0],
- defaultKeyword: codeConfig.case_default[1],
- modeProps: {
- fold: ["brace"]
- }
- });
- }
- /***/ }),
- /***/ "./js/util/iassignHelpers.js":
- /*!***********************************!*\
- !*** ./js/util/iassignHelpers.js ***!
- \***********************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "setPreviousAlgorithm": () => (/* binding */ setPreviousAlgorithm),
- /* harmony export */ "prepareActivityToStudentHelperJSON": () => (/* binding */ prepareActivityToStudentHelperJSON),
- /* harmony export */ "prepareActivityToStudentHelper": () => (/* binding */ prepareActivityToStudentHelper),
- /* harmony export */ "autoEval": () => (/* binding */ autoEval)
- /* harmony export */ });
- /* harmony import */ var _visualUI_functions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../visualUI/functions */ "./js/visualUI/functions.js");
- /* harmony import */ var _visualUI_code_generator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../visualUI/code_generator */ "./js/visualUI/code_generator.js");
- /* harmony import */ var _assessment_ivprogAssessment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../assessment/ivprogAssessment */ "./js/assessment/ivprogAssessment.js");
- /* harmony import */ var _testConsole__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./testConsole */ "./js/util/testConsole.js");
- /* harmony import */ var _services_userLog__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./../services/userLog */ "./js/services/userLog.js");
- /* harmony import */ var _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
- /* harmony import */ var _maybe__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./maybe */ "./js/util/maybe.ts");
- /* harmony import */ var _codeParser__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./codeParser */ "./js/util/codeParser.js");
- function parseActivityData(data) {
- var algorithm_in_ilm = null;
- if (data.split("\n::algorithm::")[1]) {
- algorithm_in_ilm = data.split("\n::algorithm::")[1].split("\n::logs::")[0];
- var logs = data.split("\n::algorithm::")[1].split("\n::logs::")[1];
- if (logs != null) {
- (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.parseLogs)(logs);
- }
- }
- var content;
- try {
- content = JSON.parse(data.split("\n::algorithm::")[0]);
- content["algorithm_in_ilm"] = algorithm_in_ilm;
- } catch (e) {
- console.error(e);
- return _maybe__WEBPACK_IMPORTED_MODULE_6__.Maybe.none();
- }
- return _maybe__WEBPACK_IMPORTED_MODULE_6__.Maybe.some(content);
- }
- function configAuxiliar(obj_config) {
- return new Map(Object.keys(obj_config).map(function (key) {
- return [key, obj_config[key]];
- }));
- }
- function setActivityConfig(config_json) {
- ivprogCore.Config.activity_commands = configAuxiliar(config_json.commands);
- ivprogCore.Config.activity_functions = configAuxiliar(config_json.functions);
- ivprogCore.Config.activity_datatypes = configAuxiliar(config_json.datatypes);
- ivprogCore.Config.activity_filter = configAuxiliar(config_json.filter);
- ivprogCore.Config.activity_programming_type = configAuxiliar(config_json.programming);
- }
- function setPreviousAlgorithm(code) {
- var code_obj = null;
- try {
- code_obj = ivprogCore.parseCode(code);
- (0,_codeParser__WEBPACK_IMPORTED_MODULE_7__.parserCodeVisual)(code_obj);
- } catch (e) {
- showInvalidData();
- console.log(e);
- return;
- }
- }
- function prepareActivityToStudentHelperJSON(ilm_cont) {
- (0,_visualUI_functions__WEBPACK_IMPORTED_MODULE_0__.setTestCases)(ilm_cont.test_cases);
- setActivityConfig(ilm_cont.settings);
- if (ilm_cont.code) setPreviousAlgorithm(ilm_cont.code);else if (ilm_cont.algorithm) setPreviousAlgorithm(ilm_cont.algorithm);
- }
- function prepareActivityToStudentHelper(ilm_cont) {
- var maybe_content = parseActivityData(ilm_cont);
- return maybe_content.map(function (content) {
- var testCases = content.testcases;
- (0,_visualUI_functions__WEBPACK_IMPORTED_MODULE_0__.setTestCases)(testCases);
- var prog_type = null;
- if (content.settings_programming_type) {
- prog_type = content.settings_programming_type[0].value;
- } else {
- prog_type = "visual";
- }
- return {
- settingsProgrammingType: prog_type,
- settingsDataTypes: content.settings_data_types,
- settingsCommands: content.settings_commands,
- settingsFunctions: content.settings_functions,
- algorithmInIlm: content.algorithm_in_ilm,
- settingsFilter: content.settings_filter
- };
- });
- }
- function compareArray(a, b) {
- for (var i = 0; i < a.length; ++i) {
- var elementA = a[i];
- var elementB = b[i];
- if (elementA != elementB) {
- return false;
- }
- }
- return true;
- }
- function compareTestcases(original, student) {
- if (original.length != student.length) {
- return false;
- }
- for (var i = 0; i < original.length; ++i) {
- var elementO = original[i];
- var elementS = student[i];
- if (!compareArray(elementO.input, elementS.input)) {
- return false;
- }
- if (!compareArray(elementO.output, elementS.output)) {
- return false;
- }
- }
- return true;
- }
- function autoEval(originalData, callback) {
- var code = (0,_visualUI_code_generator__WEBPACK_IMPORTED_MODULE_1__.generate)(); //console.debug(code);
- var original = parseActivityData(originalData).getOrElse(undefined);
- if (original == null) {
- alert("iAssign did not provide the original activity data!");
- return callback(null);
- }
- if (code == null) {
- return callback(-1); // @FeedbackConvention Casos de teste vazios
- } else {
- if (!compareTestcases(original.testcases, (0,_visualUI_functions__WEBPACK_IMPORTED_MODULE_0__.getTestCases)())) {
- return callback(-2); // @FeedbackConvention Casos de teste alterados pelo aluno
- }
- try {
- var ast_code = _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_5__.SemanticAnalyser.analyseFromSource(code);
- var con = new _testConsole__WEBPACK_IMPORTED_MODULE_3__.TestConsole([]);
- var autoAssessment = new _assessment_ivprogAssessment__WEBPACK_IMPORTED_MODULE_2__.IVProgAssessment(ast_code, original.testcases, con);
- autoAssessment.runTest().then(function (grade) {
- return callback(grade);
- })["catch"](function (err) {
- console.log(err);
- callback(-5); // @FeedbackConvention Falha na execução
- });
- } catch (e) {
- console.error(e);
- callback(-5);
- }
- }
- }
- /***/ }),
- /***/ "./js/util/inputTest.js":
- /*!******************************!*\
- !*** ./js/util/inputTest.js ***!
- \******************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "InputTest": () => (/* binding */ InputTest)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
- /* harmony import */ var _io_input__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./../io/input */ "./js/io/input.js");
- /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../services/localizedStringsService */ "./js/services/localizedStringsService.js");
- 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); }; }
- 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; } }
- var InputTest = /*#__PURE__*/function (_Input) {
- _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(InputTest, _Input);
- var _super = _createSuper(InputTest);
- function InputTest(inputList) {
- var _this;
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, InputTest);
- _this = _super.call(this);
- _this.index = 0;
- _this.inputList = inputList;
- return _this;
- }
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(InputTest, [{
- key: "requestInput",
- value: function requestInput() {
- var _this2 = this;
- var promise = new Promise(function (resolve, reject) {
- if (_this2.index < _this2.inputList.length) {
- resolve(_this2.inputList[_this2.index]);
- _this2.index++;
- } else {
- reject(new Error(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_6__.LocalizedStrings.getError("exceeded_input_request")));
- }
- });
- return promise;
- }
- }]);
- return InputTest;
- }(_io_input__WEBPACK_IMPORTED_MODULE_5__.Input);
- /***/ }),
- /***/ "./js/util/input_assessment.js":
- /*!*************************************!*\
- !*** ./js/util/input_assessment.js ***!
- \*************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "InputAssessment": () => (/* binding */ InputAssessment)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
- /* harmony import */ var _io_input__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./../io/input */ "./js/io/input.js");
- /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../services/localizedStringsService */ "./js/services/localizedStringsService.js");
- 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); }; }
- 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; } }
- var InputAssessment = /*#__PURE__*/function (_Input) {
- _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(InputAssessment, _Input);
- var _super = _createSuper(InputAssessment);
- function InputAssessment(input_list) {
- var _this;
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, InputAssessment);
- _this = _super.call(this);
- _this.index = 0;
- _this.input_list = input_list.map(function (val) {
- return {
- "value": val,
- "read": false
- };
- });
- return _this;
- }
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(InputAssessment, [{
- key: "requestInput",
- value: function requestInput() {
- var _this2 = this;
- var promise = new Promise(function (resolve, reject) {
- if (_this2.index < _this2.input_list.length) {
- var input = _this2.input_list[_this2.index];
- input.read = true;
- _this2.index += 1;
- resolve(input.value);
- } else {
- reject(new Error(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_6__.LocalizedStrings.getError("exceeded_input_request")));
- }
- });
- return promise;
- }
- }, {
- key: "isInputAvailable",
- value: function isInputAvailable() {
- return this.index < this.input_list.length;
- }
- }]);
- return InputAssessment;
- }(_io_input__WEBPACK_IMPORTED_MODULE_5__.Input);
- /***/ }),
- /***/ "./js/util/outputTest.js":
- /*!*******************************!*\
- !*** ./js/util/outputTest.js ***!
- \*******************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "OutputTest": () => (/* binding */ OutputTest)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
- /* harmony import */ var _io_output__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./../io/output */ "./js/io/output.js");
- 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); }; }
- 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; } }
- var OutputTest = /*#__PURE__*/function (_Output) {
- _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(OutputTest, _Output);
- var _super = _createSuper(OutputTest);
- function OutputTest() {
- var _this;
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, OutputTest);
- _this = _super.call(this);
- _this.list = [];
- _this.currentLine = null;
- return _this;
- }
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(OutputTest, [{
- key: "write",
- value: function write(text) {
- var newLine = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- if (this.currentLine == null) {
- this.currentLine = this.list.push("") - 1;
- }
- this.list[this.currentLine] += text;
- if (newLine) {
- this.currentLine = null;
- }
- }
- }, {
- key: "sendOutput",
- value: function sendOutput(text) {
- var _this2 = this;
- var output = "" + text;
- if (output.indexOf("\n") !== -1) {
- var outputList = output.split("\n");
- var last = outputList.pop();
- outputList.forEach(function (t) {
- //t = t.replace(/\t/g, '  ');
- //t = t.replace(/\s/g, " ");
- if (t.length == 0) _this2.currentLine = null;else _this2.write(t, true);
- }); //last = last.replace(/\t/g, '  ');
- //last = last.replace(/\s/g, " ");
- if (last.length != 0) this.write(last);
- } else {
- //output = output.replace(/\t/g, '  ');
- //output = output.replace(/\s/g, " ");
- this.write(output);
- }
- }
- }]);
- return OutputTest;
- }(_io_output__WEBPACK_IMPORTED_MODULE_5__.Output);
- /***/ }),
- /***/ "./js/util/parseFromVisual.js":
- /*!************************************!*\
- !*** ./js/util/parseFromVisual.js ***!
- \************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "parseExpression": () => (/* binding */ parseExpression),
- /* harmony export */ "parseCode": () => (/* binding */ parseCode)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "./node_modules/@babel/runtime/helpers/toConsumableArray.js");
- /* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../ast/ivprogParser */ "./js/ast/ivprogParser.js");
- /* harmony import */ var _ast_expressions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ast/expressions */ "./js/ast/expressions/index.js");
- /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../typeSystem/types */ "./js/typeSystem/types.ts");
- /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../typeSystem/parsers */ "./js/typeSystem/parsers.js");
- /* harmony import */ var _ast_commands__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../ast/commands */ "./js/ast/commands/index.js");
- /* harmony import */ var _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../typeSystem/array_type */ "./js/typeSystem/array_type.ts");
- /* harmony import */ var _ast_expressions_literal__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../ast/expressions/literal */ "./js/ast/expressions/literal.js");
- var TYPES = {
- VARIABLE: "var",
- CONST: "const",
- FUNCTION: "function",
- RELATIONAL: "relational",
- LOGIC: "logic",
- ARITHMETIC: "arithmetic"
- };
- function translateOp(type, op) {
- switch (type) {
- case TYPES.ARITHMETIC:
- return op.value;
- case TYPES.RELATIONAL:
- return op.value;
- case TYPES.LOGIC:
- {
- if (op.ord === 11) {
- return "and";
- } else if (op.ord === 12) {
- return "or";
- } else {
- return "not";
- }
- }
- }
- }
- function getOpType(op) {
- switch (op.ord) {
- case 0:
- case 1:
- case 2:
- case 3:
- case 4:
- return TYPES.ARITHMETIC;
- case 5:
- case 6:
- case 7:
- case 8:
- case 9:
- case 10:
- return TYPES.RELATIONAL;
- default:
- return TYPES.LOGIC;
- }
- }
- /**
- * @param {Commands.Case} switchCase
- * */
- function switchCaseWalker(switchCase) {
- var commands = switchCase.commands.map(commandWalker);
- var expression = switchCase.isDefault ? null : expressionWalker(switchCase.expression);
- return {
- type: "switchcase",
- line: switchCase.sourceInfo.line,
- expression: expression,
- commands: commands
- };
- }
- /**
- * @param {Commands.Switch} switchCommand
- * */
- function switchWalker(switchCommand) {
- var expression = expressionWalker(switchCommand.expression);
- var cases = switchCommand.cases.map(switchCaseWalker);
- return {
- type: "switch",
- expression: expression,
- cases: cases
- };
- }
- /**
- * @param {Commands.Return} returnCommand
- * */
- function returnWalker(returnCommand) {
- var expression = expressionWalker(returnCommand.expression);
- return {
- type: "return",
- expression: expression
- };
- }
- function breakWalker(_) {
- return {
- type: "break"
- };
- }
- /**
- * @param {Commands.For} forLoop
- * */
- function forWalker(forLoop) {
- var var_attribution = expressionWalker(forLoop.for_id);
- var var_initial = expressionWalker(forLoop.for_from);
- var condition = expressionWalker(forLoop.for_to);
- var step_expression = forLoop.for_pass ? expressionWalker(forLoop.for_pass) : [];
- var commands = forLoop.commands.map(commandWalker);
- return {
- type: "repeatNtimes",
- var_attribution: var_attribution,
- var_initial: var_initial,
- condition: condition,
- step_expression: step_expression,
- commands: commands
- };
- }
- /**
- * @param {Commands.While} whileLoop
- * */
- function whileWalker(whileLoop) {
- var expression = expressionWalker(whileLoop.expression);
- var commands = whileLoop.commands.map(commandWalker);
- var type = whileLoop.testFirst ? "whiletrue" : "dowhiletrue";
- return {
- type: type,
- expression: expression,
- commands: commands
- };
- }
- /**
- * @param {Commands.IfThenElse} ifthenelse
- * */
- function ifThenElseWalker(ifthenelse) {
- //ifthenelse.
- var expression = expressionWalker(ifthenelse.condition);
- var ifTrue = ifthenelse.ifTrue.commands.map(commandWalker);
- var ifFalse = [];
- if (ifthenelse.ifFalse) {
- if (ifthenelse.ifFalse instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_5__.CommandBlock) {
- ifFalse = ifthenelse.ifFalse.commands.map(commandWalker);
- } else {
- ifFalse = [ifThenElseWalker(ifthenelse.ifFalse)];
- }
- }
- return {
- type: "iftrue",
- expression: expression,
- ifTrue: ifTrue,
- ifFalse: ifFalse
- };
- }
- /**
- * @param {Commands.Assign} assingment
- * */
- function assignmentWalker(assingment) {
- var variable = null;
- if (assingment instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_5__.ArrayIndexAssign) {
- var line = expressionWalker(assingment.line);
- var arrayClass = "vector";
- var column = null;
- if (assingment.column) {
- arrayClass = "matrix";
- column = expressionWalker(assingment.column);
- }
- variable = [{
- instance: "expression",
- type: TYPES.VARIABLE,
- "class": arrayClass,
- column: column,
- line: line,
- value: assingment.id
- }];
- } else {
- variable = [{
- instance: "expression",
- type: TYPES.VARIABLE,
- value: assingment.id
- }];
- }
- var expression = expressionWalker(assingment.expression);
- return {
- type: "attribution",
- variable: variable,
- expression: expression
- };
- }
- /**
- * @param {Command} command
- * */
- function commandWalker(command) {
- var parsedCommand = null;
- if (command instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_5__.FunctionCall) {
- parsedCommand = functionCallWalker(command);
- } else if (command instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_5__.Assign) {
- parsedCommand = assignmentWalker(command);
- } else if (command instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_5__.IfThenElse) {
- parsedCommand = ifThenElseWalker(command);
- } else if (command instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_5__.While) {
- parsedCommand = whileWalker(command);
- } else if (command instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_5__.Break) {
- parsedCommand = breakWalker(command);
- } else if (command instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_5__.Return) {
- parsedCommand = returnWalker(command);
- } else if (command instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_5__.Switch) {
- parsedCommand = switchWalker(command);
- } else if (command instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_5__.For) {
- parsedCommand = forWalker(command);
- } else {
- throw new Error("not implemented");
- }
- parsedCommand.line = command.sourceInfo.line;
- return parsedCommand;
- }
- /**
- * @param {Commands.FunctionCall} functionCall
- * */
- function functionCallWalker(functionCall) {
- var name = functionCall.id;
- if (name.indexOf(".") !== -1) {
- name = name.split(".")[1];
- }
- var parameters = functionCall.actualParameters.map(expressionWalker);
- if (name === "$write") {
- var lastInput = parameters[parameters.length - 1][0]; // if lastInput is an object with value === '\n', newLine is true
- var newLine = lastInput.value && lastInput.value.match(/^\n$/) !== null;
- var content = newLine ? parameters.slice(0, parameters.length - 1) : parameters;
- return {
- type: "writer",
- newLine: newLine,
- content: content
- };
- }
- if (name === "$read") {
- return {
- type: "reader",
- variable: parameters[0]
- };
- }
- return {
- type: "functioncall",
- parameters_list: parameters,
- name: functionCall.id
- };
- }
- /**
- * @param {Commands.Function} func
- * */
- function functionWalker(func) {
- var funcDeclaration = {
- name: func.name,
- line: func.sourceInfo.line,
- return_type: "",
- return_dimensions: 0,
- parameters_list: [],
- variables_list: [],
- commands: []
- };
- if (func.returnType instanceof _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_6__.ArrayType) {
- funcDeclaration.return_type = func.returnType.innerType.value;
- funcDeclaration.return_dimensions = func.returnType.dimensions;
- } else {
- funcDeclaration.return_type = func.returnType.value;
- }
- funcDeclaration.parameters_list = func.formalParameters.map(functionParameterWalker);
- funcDeclaration.variables_list = func.variablesDeclarations.map(variableDeclarationWalker);
- funcDeclaration.commands = func.commands.map(commandWalker);
- return funcDeclaration;
- }
- /**
- * @param {Commands.FormalParameter} formalParameter
- * */
- function functionParameterWalker(formalParameter) {
- var variable = {
- name: formalParameter.id,
- line: formalParameter.sourceInfo.line,
- type: "",
- rows: 0,
- columns: 0,
- dimension: 0,
- value: 0,
- is_const: false,
- reference: formalParameter.byRef
- };
- if (formalParameter.type instanceof _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_6__.ArrayType) {
- variable.type = formalParameter.type.innerType.value;
- variable.dimension = formalParameter.type.dimensions;
- } else {
- variable.type = formalParameter.type.value;
- }
- return variable;
- }
- /**
- * @param {Commands.Declaration} command
- * @param {boolean} global
- * */
- function variableDeclarationWalker(command) {
- var global = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- var variable = {
- name: command.id,
- line: command.sourceInfo.line,
- type: "",
- rows: 0,
- columns: 0,
- dimension: 0,
- value: 0,
- is_const: false
- };
- variable.is_const = global && command.isConst;
- if (command instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_5__.ArrayDeclaration) {
- // array
- var lines = expressionWalker(command.lines).pop();
- variable.type = command.type.innerType.value;
- if (command.isVector) {
- variable.columns = lines.value;
- variable.dimension = 1;
- var values = command.initial.value.map(function (exp) {
- return variableInitialWalker(exp);
- });
- variable.value = values;
- } else {
- var columns = expressionWalker(command.columns).pop();
- variable.dimension = 2;
- variable.rows = lines.value;
- variable.columns = columns.value;
- var _values = command.initial.value.map(function (rows) {
- return rows.value.map(function (exp) {
- return variableInitialWalker(exp);
- });
- });
- variable.value = _values;
- }
- } else {
- // atomic
- variable.type = command.type.value;
- variable.value = variableInitialWalker(command.initial);
- }
- return variable;
- }
- /**
- * @param {any} expression
- * */
- function variableInitialWalker(expression) {
- if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_2__.UnaryApp) {
- var left = variableInitialWalker(expression.left);
- var opType = getOpType(expression.op);
- if (opType !== TYPES.ARITHMETIC) {
- throw new Error("invalid variable initial value: " + expression.toString());
- }
- return "".concat(expression.op.value).concat(left);
- } else if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_2__.BoolLiteral) {
- var value = expression.value;
- return (0,_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_4__.convertBoolToString)(value);
- } else if (expression instanceof _ast_expressions_literal__WEBPACK_IMPORTED_MODULE_7__.Literal) {
- var _value = expression.value;
- if (expression.value.toNumber) {
- if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.REAL.isCompatible(expression.type) && expression.value.decimalPlaces() == 0) {
- _value = expression.value.toFixed(2);
- } else {
- _value = expression.value.toNumber();
- }
- }
- return _value;
- }
- throw new Error("invalid variable initial value: " + expression.toString());
- }
- /**
- *
- * @return {[]}
- **/
- function expressionWalker(expression) {
- var result;
- if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_2__.VariableLiteral) {
- result = [{
- instance: "expression",
- type: TYPES.VARIABLE,
- value: expression.id
- }];
- } else if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_2__.FunctionCall) {
- var funcObj = {
- instance: "expression",
- type: TYPES.FUNCTION,
- value: expression.id
- };
- var paramsList = expression.actualParameters.map(function (e) {
- return expressionWalker(e);
- }); //const params = Array.prototype.concat.apply([], paramsList);
- funcObj.params = paramsList;
- result = [funcObj];
- } else if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_2__.UnaryApp) {
- console.log(expression);
- var left = expressionWalker(expression.left);
- var opType = getOpType(expression.op);
- var opValue = translateOp(opType, expression.op);
- result = [{
- instance: "operator",
- type: opType,
- value: opValue
- }].concat(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default()(left));
- } else if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_2__.InfixApp) {
- var _left = expressionWalker(expression.left);
- var right = expressionWalker(expression.right);
- var _opType = getOpType(expression.op);
- var _opValue = translateOp(_opType, expression.op);
- result = [].concat(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default()(_left), [{
- instance: "operator",
- type: _opType,
- value: _opValue
- }], _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default()(right));
- } else if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_2__.ArrayAccess) {
- var line = expressionWalker(expression.line);
- var arrayClass = "vector";
- var column = null;
- if (expression.column) {
- arrayClass = "matrix";
- column = expressionWalker(expression.column);
- }
- result = [{
- instance: "expression",
- type: TYPES.VARIABLE,
- "class": arrayClass,
- column: column,
- line: line,
- value: expression.id
- }];
- } else if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_2__.BoolLiteral) {
- var value = expression.value;
- result = [{
- instance: "expression",
- "class": "simple",
- type: TYPES.CONST,
- value: (0,_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_4__.convertBoolToString)(value)
- }];
- } else {
- var _value2 = expression.value;
- if (expression.value.toNumber) {
- if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.REAL.isCompatible(expression.type) && expression.value.decimalPlaces() == 0) {
- _value2 = expression.value.toFixed(2);
- } else {
- _value2 = expression.value.toNumber();
- }
- }
- result = [{
- instance: "expression",
- "class": "simple",
- type: TYPES.CONST,
- value: _value2
- }];
- }
- if (expression.parenthesis) return ["("].concat(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default()(result), [")"]);else return result;
- }
- function parseExpression(text) {
- var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_1__.IVProgParser.createParser(text);
- var expressionAST = parser.parseExpressionOR();
- return expressionWalker(expressionAST);
- }
- /**
- * @param {string} text
- * */
- function parseCode(text) {
- var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_1__.IVProgParser.createParser(text, false);
- var codeLinesMap = new Map();
- var tokens = Array.from(parser.lexer.reset(text));
- var tokenStream = [];
- for (var _i = 0, _tokens = tokens; _i < _tokens.length; _i++) {
- var token = _tokens[_i];
- if (token.type === parser.ruleNames.ERROR) {
- return null;
- }
- if (token.type === parser.ruleNames.COMMENTS) {
- for (var i = 0; i <= token.lineBreaks; i++) {
- if (codeLinesMap.has(i + token.line)) codeLinesMap.get(i + token.line).push(token);else codeLinesMap.set(i + token.line, [token]);
- }
- continue;
- }
- if (token.type !== parser.ruleNames.WHITESPACE) {
- tokenStream.push(token);
- }
- }
- parser.fill(tokenStream);
- try {
- var program = parser.parseTree();
- var globals = program.global.map(function (decl) {
- return variableDeclarationWalker(decl, true);
- });
- var functions = program.functions.map(functionWalker);
- return {
- globals: globals,
- functions: functions
- };
- } catch (e) {
- console.error(e);
- return null;
- }
- }
- /***/ }),
- /***/ "./js/util/string_diff.js":
- /*!********************************!*\
- !*** ./js/util/string_diff.js ***!
- \********************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
- /* harmony export */ });
- /**
- * Author: @jhchen - https://github.com/jhchen
- * Modified by: @lucascalion - 23/07/2019
- * This library modifies the diff-patch-match library by Neil Fraser
- * by removing the patch and match functionality and certain advanced
- * options in the diff function. The original license is as follows:
- *
- * ===
- *
- * Diff Match and Patch
- *
- * Copyright 2006 Google Inc.
- * http://code.google.com/p/google-diff-match-patch/
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /**
- * The data structure representing a diff is an array of tuples:
- * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']]
- * which means: delete 'Hello', add 'Goodbye' and keep ' world.'
- */
- var DIFF_DELETE = -1;
- var DIFF_INSERT = 1;
- var DIFF_EQUAL = 0;
- /**
- * Find the differences between two texts. Simplifies the problem by stripping
- * any common prefix or suffix off the texts before diffing.
- * @param {string} text1 Old string to be diffed.
- * @param {string} text2 New string to be diffed.
- * @param {Int|Object} [cursor_pos] Edit position in text1 or object with more info
- * @return {Array} Array of diff tuples.
- */
- function diff_main(text1, text2, cursor_pos, _fix_unicode) {
- // Check for equality
- if (text1 === text2) {
- if (text1) {
- return [[DIFF_EQUAL, text1]];
- }
- return [];
- }
- if (cursor_pos != null) {
- var editdiff = find_cursor_edit_diff(text1, text2, cursor_pos);
- if (editdiff) {
- return editdiff;
- }
- } // Trim off common prefix (speedup).
- var commonlength = diff_commonPrefix(text1, text2);
- var commonprefix = text1.substring(0, commonlength);
- text1 = text1.substring(commonlength);
- text2 = text2.substring(commonlength); // Trim off common suffix (speedup).
- commonlength = diff_commonSuffix(text1, text2);
- var commonsuffix = text1.substring(text1.length - commonlength);
- text1 = text1.substring(0, text1.length - commonlength);
- text2 = text2.substring(0, text2.length - commonlength); // Compute the diff on the middle block.
- var diffs = diff_compute_(text1, text2); // Restore the prefix and suffix.
- if (commonprefix) {
- diffs.unshift([DIFF_EQUAL, commonprefix]);
- }
- if (commonsuffix) {
- diffs.push([DIFF_EQUAL, commonsuffix]);
- }
- diff_cleanupMerge(diffs, _fix_unicode);
- return diffs;
- }
- /**
- * Find the differences between two texts. Assumes that the texts do not
- * have any common prefix or suffix.
- * @param {string} text1 Old string to be diffed.
- * @param {string} text2 New string to be diffed.
- * @return {Array} Array of diff tuples.
- */
- function diff_compute_(text1, text2) {
- var diffs;
- if (!text1) {
- // Just add some text (speedup).
- return [[DIFF_INSERT, text2]];
- }
- if (!text2) {
- // Just delete some text (speedup).
- return [[DIFF_DELETE, text1]];
- }
- var longtext = text1.length > text2.length ? text1 : text2;
- var shorttext = text1.length > text2.length ? text2 : text1;
- var i = longtext.indexOf(shorttext);
- if (i !== -1) {
- // Shorter text is inside the longer text (speedup).
- 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.
- if (text1.length > text2.length) {
- diffs[0][0] = diffs[2][0] = DIFF_DELETE;
- }
- return diffs;
- }
- if (shorttext.length === 1) {
- // Single character string.
- // After the previous speedup, the character can't be an equality.
- return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];
- } // Check to see if the problem can be split in two.
- var hm = diff_halfMatch_(text1, text2);
- if (hm) {
- // A half-match was found, sort out the return data.
- var text1_a = hm[0];
- var text1_b = hm[1];
- var text2_a = hm[2];
- var text2_b = hm[3];
- var mid_common = hm[4]; // Send both pairs off for separate processing.
- var diffs_a = diff_main(text1_a, text2_a);
- var diffs_b = diff_main(text1_b, text2_b); // Merge the results.
- return diffs_a.concat([[DIFF_EQUAL, mid_common]], diffs_b);
- }
- return diff_bisect_(text1, text2);
- }
- /**
- * Find the 'middle snake' of a diff, split the problem in two
- * and return the recursively constructed diff.
- * See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations.
- * @param {string} text1 Old string to be diffed.
- * @param {string} text2 New string to be diffed.
- * @return {Array} Array of diff tuples.
- * @private
- */
- function diff_bisect_(text1, text2) {
- // Cache the text lengths to prevent multiple calls.
- var text1_length = text1.length;
- var text2_length = text2.length;
- var max_d = Math.ceil((text1_length + text2_length) / 2);
- var v_offset = max_d;
- var v_length = 2 * max_d;
- var v1 = new Array(v_length);
- var v2 = new Array(v_length); // Setting all elements to -1 is faster in Chrome & Firefox than mixing
- // integers and undefined.
- for (var x = 0; x < v_length; x++) {
- v1[x] = -1;
- v2[x] = -1;
- }
- v1[v_offset + 1] = 0;
- v2[v_offset + 1] = 0;
- var delta = text1_length - text2_length; // If the total number of characters is odd, then the front path will collide
- // with the reverse path.
- var front = delta % 2 !== 0; // Offsets for start and end of k loop.
- // Prevents mapping of space beyond the grid.
- var k1start = 0;
- var k1end = 0;
- var k2start = 0;
- var k2end = 0;
- for (var d = 0; d < max_d; d++) {
- // Walk the front path one step.
- for (var k1 = -d + k1start; k1 <= d - k1end; k1 += 2) {
- var k1_offset = v_offset + k1;
- var x1 = void 0;
- if (k1 === -d || k1 !== d && v1[k1_offset - 1] < v1[k1_offset + 1]) {
- x1 = v1[k1_offset + 1];
- } else {
- x1 = v1[k1_offset - 1] + 1;
- }
- var y1 = x1 - k1;
- while (x1 < text1_length && y1 < text2_length && text1.charAt(x1) === text2.charAt(y1)) {
- x1++;
- y1++;
- }
- v1[k1_offset] = x1;
- if (x1 > text1_length) {
- // Ran off the right of the graph.
- k1end += 2;
- } else if (y1 > text2_length) {
- // Ran off the bottom of the graph.
- k1start += 2;
- } else if (front) {
- var k2_offset = v_offset + delta - k1;
- if (k2_offset >= 0 && k2_offset < v_length && v2[k2_offset] !== -1) {
- // Mirror x2 onto top-left coordinate system.
- var x2 = text1_length - v2[k2_offset];
- if (x1 >= x2) {
- // Overlap detfrontected.
- return diff_bisectSplit_(text1, text2, x1, y1);
- }
- }
- }
- } // Walk the reverse path one step.
- for (var k2 = -d + k2start; k2 <= d - k2end; k2 += 2) {
- var _k2_offset = v_offset + k2;
- var _x = void 0;
- if (k2 === -d || k2 !== d && v2[_k2_offset - 1] < v2[_k2_offset + 1]) {
- _x = v2[_k2_offset + 1];
- } else {
- _x = v2[_k2_offset - 1] + 1;
- }
- var y2 = _x - k2;
- while (_x < text1_length && y2 < text2_length && text1.charAt(text1_length - _x - 1) === text2.charAt(text2_length - y2 - 1)) {
- _x++;
- y2++;
- }
- v2[_k2_offset] = _x;
- if (_x > text1_length) {
- // Ran off the left of the graph.
- k2end += 2;
- } else if (y2 > text2_length) {
- // Ran off the top of the graph.
- k2start += 2;
- } else if (!front) {
- var _k1_offset = v_offset + delta - k2;
- if (_k1_offset >= 0 && _k1_offset < v_length && v1[_k1_offset] !== -1) {
- var _x2 = v1[_k1_offset];
- var _y = v_offset + _x2 - _k1_offset; // Mirror x2 onto top-left coordinate system.
- _x = text1_length - _x;
- if (_x2 >= _x) {
- // Overlap detected.
- return diff_bisectSplit_(text1, text2, _x2, _y);
- }
- }
- }
- }
- } // Diff took too long and hit the deadline or
- // number of diffs equals number of characters, no commonality at all.
- return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];
- }
- /**
- * Given the location of the 'middle snake', split the diff in two parts
- * and recurse.
- * @param {string} text1 Old string to be diffed.
- * @param {string} text2 New string to be diffed.
- * @param {number} x Index of split point in text1.
- * @param {number} y Index of split point in text2.
- * @return {Array} Array of diff tuples.
- */
- function diff_bisectSplit_(text1, text2, x, y) {
- var text1a = text1.substring(0, x);
- var text2a = text2.substring(0, y);
- var text1b = text1.substring(x);
- var text2b = text2.substring(y); // Compute both diffs serially.
- var diffs = diff_main(text1a, text2a);
- var diffsb = diff_main(text1b, text2b);
- return diffs.concat(diffsb);
- }
- /**
- * Determine the common prefix of two strings.
- * @param {string} text1 First string.
- * @param {string} text2 Second string.
- * @return {number} The number of characters common to the start of each
- * string.
- */
- function diff_commonPrefix(text1, text2) {
- // Quick check for common null cases.
- if (!text1 || !text2 || text1.charAt(0) !== text2.charAt(0)) {
- return 0;
- } // Binary search.
- // Performance analysis: http://neil.fraser.name/news/2007/10/09/
- var pointermin = 0;
- var pointermax = Math.min(text1.length, text2.length);
- var pointermid = pointermax;
- var pointerstart = 0;
- while (pointermin < pointermid) {
- if (text1.substring(pointerstart, pointermid) == text2.substring(pointerstart, pointermid)) {
- pointermin = pointermid;
- pointerstart = pointermin;
- } else {
- pointermax = pointermid;
- }
- pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
- }
- if (is_surrogate_pair_start(text1.charCodeAt(pointermid - 1))) {
- pointermid--;
- }
- return pointermid;
- }
- /**
- * Determine the common suffix of two strings.
- * @param {string} text1 First string.
- * @param {string} text2 Second string.
- * @return {number} The number of characters common to the end of each string.
- */
- function diff_commonSuffix(text1, text2) {
- // Quick check for common null cases.
- if (!text1 || !text2 || text1.slice(-1) !== text2.slice(-1)) {
- return 0;
- } // Binary search.
- // Performance analysis: http://neil.fraser.name/news/2007/10/09/
- var pointermin = 0;
- var pointermax = Math.min(text1.length, text2.length);
- var pointermid = pointermax;
- var pointerend = 0;
- while (pointermin < pointermid) {
- if (text1.substring(text1.length - pointermid, text1.length - pointerend) == text2.substring(text2.length - pointermid, text2.length - pointerend)) {
- pointermin = pointermid;
- pointerend = pointermin;
- } else {
- pointermax = pointermid;
- }
- pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
- }
- if (is_surrogate_pair_end(text1.charCodeAt(text1.length - pointermid))) {
- pointermid--;
- }
- return pointermid;
- }
- /**
- * Do the two texts share a substring which is at least half the length of the
- * longer text?
- * This speedup can produce non-minimal diffs.
- * @param {string} text1 First string.
- * @param {string} text2 Second string.
- * @return {Array.<string>} Five element Array, containing the prefix of
- * text1, the suffix of text1, the prefix of text2, the suffix of
- * text2 and the common middle. Or null if there was no match.
- */
- function diff_halfMatch_(text1, text2) {
- var longtext = text1.length > text2.length ? text1 : text2;
- var shorttext = text1.length > text2.length ? text2 : text1;
- if (longtext.length < 4 || shorttext.length * 2 < longtext.length) {
- return null; // Pointless.
- }
- /**
- * Does a substring of shorttext exist within longtext such that the substring
- * is at least half the length of longtext?
- * Closure, but does not reference any external variables.
- * @param {string} longtext Longer string.
- * @param {string} shorttext Shorter string.
- * @param {number} i Start index of quarter length substring within longtext.
- * @return {Array.<string>} Five element Array, containing the prefix of
- * longtext, the suffix of longtext, the prefix of shorttext, the suffix
- * of shorttext and the common middle. Or null if there was no match.
- * @private
- */
- function diff_halfMatchI_(longtext, shorttext, i) {
- // Start with a 1/4 length substring at position i as a seed.
- var seed = longtext.substring(i, i + Math.floor(longtext.length / 4));
- var j = -1;
- var best_common = '';
- var best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b;
- while ((j = shorttext.indexOf(seed, j + 1)) !== -1) {
- var prefixLength = diff_commonPrefix(longtext.substring(i), shorttext.substring(j));
- var suffixLength = diff_commonSuffix(longtext.substring(0, i), shorttext.substring(0, j));
- if (best_common.length < suffixLength + prefixLength) {
- best_common = shorttext.substring(j - suffixLength, j) + shorttext.substring(j, j + prefixLength);
- best_longtext_a = longtext.substring(0, i - suffixLength);
- best_longtext_b = longtext.substring(i + prefixLength);
- best_shorttext_a = shorttext.substring(0, j - suffixLength);
- best_shorttext_b = shorttext.substring(j + prefixLength);
- }
- }
- if (best_common.length * 2 >= longtext.length) {
- return [best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b, best_common];
- } else {
- return null;
- }
- } // First check if the second quarter is the seed for a half-match.
- var hm1 = diff_halfMatchI_(longtext, shorttext, Math.ceil(longtext.length / 4)); // Check again based on the third quarter.
- var hm2 = diff_halfMatchI_(longtext, shorttext, Math.ceil(longtext.length / 2));
- var hm;
- if (!hm1 && !hm2) {
- return null;
- } else if (!hm2) {
- hm = hm1;
- } else if (!hm1) {
- hm = hm2;
- } else {
- // Both matched. Select the longest.
- hm = hm1[4].length > hm2[4].length ? hm1 : hm2;
- } // A half-match was found, sort out the return data.
- var text1_a, text1_b, text2_a, text2_b;
- if (text1.length > text2.length) {
- text1_a = hm[0];
- text1_b = hm[1];
- text2_a = hm[2];
- text2_b = hm[3];
- } else {
- text2_a = hm[0];
- text2_b = hm[1];
- text1_a = hm[2];
- text1_b = hm[3];
- }
- var mid_common = hm[4];
- return [text1_a, text1_b, text2_a, text2_b, mid_common];
- }
- /**
- * Reorder and merge like edit sections. Merge equalities.
- * Any edit section can move as long as it doesn't cross an equality.
- * @param {Array} diffs Array of diff tuples.
- * @param {boolean} fix_unicode Whether to normalize to a unicode-correct diff
- */
- function diff_cleanupMerge(diffs, fix_unicode) {
- diffs.push([DIFF_EQUAL, '']); // Add a dummy entry at the end.
- var pointer = 0;
- var count_delete = 0;
- var count_insert = 0;
- var text_delete = '';
- var text_insert = '';
- var commonlength;
- var previous_equality;
- while (pointer < diffs.length) {
- if (pointer < diffs.length - 1 && !diffs[pointer][1]) {
- diffs.splice(pointer, 1);
- continue;
- }
- switch (diffs[pointer][0]) {
- case DIFF_INSERT:
- count_insert++;
- text_insert += diffs[pointer][1];
- pointer++;
- break;
- case DIFF_DELETE:
- count_delete++;
- text_delete += diffs[pointer][1];
- pointer++;
- break;
- case DIFF_EQUAL:
- previous_equality = pointer - count_insert - count_delete - 1;
- if (fix_unicode) {
- // prevent splitting of unicode surrogate pairs. when fix_unicode is true,
- // we assume that the old and new text in the diff are complete and correct
- // unicode-encoded JS strings, but the tuple boundaries may fall between
- // surrogate pairs. we fix this by shaving off stray surrogates from the end
- // of the previous equality and the beginning of this equality. this may create
- // empty equalities or a common prefix or suffix. for example, if AB and AC are
- // emojis, `[[0, 'A'], [-1, 'BA'], [0, 'C']]` would turn into deleting 'ABAC' and
- // inserting 'AC', and then the common suffix 'AC' will be eliminated. in this
- // particular case, both equalities go away, we absorb any previous inequalities,
- // and we keep scanning for the next equality before rewriting the tuples.
- if (previous_equality >= 0 && ends_with_pair_start(diffs[previous_equality][1])) {
- var stray = diffs[previous_equality][1].slice(-1);
- diffs[previous_equality][1] = diffs[previous_equality][1].slice(0, -1);
- text_delete = stray + text_delete;
- text_insert = stray + text_insert;
- if (!diffs[previous_equality][1]) {
- // emptied out previous equality, so delete it and include previous delete/insert
- diffs.splice(previous_equality, 1);
- pointer--;
- var k = previous_equality - 1;
- if (diffs[k] && diffs[k][0] === DIFF_INSERT) {
- count_insert++;
- text_insert = diffs[k][1] + text_insert;
- k--;
- }
- if (diffs[k] && diffs[k][0] === DIFF_DELETE) {
- count_delete++;
- text_delete = diffs[k][1] + text_delete;
- k--;
- }
- previous_equality = k;
- }
- }
- if (starts_with_pair_end(diffs[pointer][1])) {
- var _stray = diffs[pointer][1].charAt(0);
- diffs[pointer][1] = diffs[pointer][1].slice(1);
- text_delete += _stray;
- text_insert += _stray;
- }
- }
- if (pointer < diffs.length - 1 && !diffs[pointer][1]) {
- // for empty equality not at end, wait for next equality
- diffs.splice(pointer, 1);
- break;
- }
- if (text_delete.length > 0 || text_insert.length > 0) {
- // note that diff_commonPrefix and diff_commonSuffix are unicode-aware
- if (text_delete.length > 0 && text_insert.length > 0) {
- // Factor out any common prefixes.
- commonlength = diff_commonPrefix(text_insert, text_delete);
- if (commonlength !== 0) {
- if (previous_equality >= 0) {
- diffs[previous_equality][1] += text_insert.substring(0, commonlength);
- } else {
- diffs.splice(0, 0, [DIFF_EQUAL, text_insert.substring(0, commonlength)]);
- pointer++;
- }
- text_insert = text_insert.substring(commonlength);
- text_delete = text_delete.substring(commonlength);
- } // Factor out any common suffixes.
- commonlength = diff_commonSuffix(text_insert, text_delete);
- if (commonlength !== 0) {
- diffs[pointer][1] = text_insert.substring(text_insert.length - commonlength) + diffs[pointer][1];
- text_insert = text_insert.substring(0, text_insert.length - commonlength);
- text_delete = text_delete.substring(0, text_delete.length - commonlength);
- }
- } // Delete the offending records and add the merged ones.
- var n = count_insert + count_delete;
- if (text_delete.length === 0 && text_insert.length === 0) {
- diffs.splice(pointer - n, n);
- pointer = pointer - n;
- } else if (text_delete.length === 0) {
- diffs.splice(pointer - n, n, [DIFF_INSERT, text_insert]);
- pointer = pointer - n + 1;
- } else if (text_insert.length === 0) {
- diffs.splice(pointer - n, n, [DIFF_DELETE, text_delete]);
- pointer = pointer - n + 1;
- } else {
- diffs.splice(pointer - n, n, [DIFF_DELETE, text_delete], [DIFF_INSERT, text_insert]);
- pointer = pointer - n + 2;
- }
- }
- if (pointer !== 0 && diffs[pointer - 1][0] === DIFF_EQUAL) {
- // Merge this equality with the previous one.
- diffs[pointer - 1][1] += diffs[pointer][1];
- diffs.splice(pointer, 1);
- } else {
- pointer++;
- }
- count_insert = 0;
- count_delete = 0;
- text_delete = '';
- text_insert = '';
- break;
- }
- }
- if (diffs[diffs.length - 1][1] === '') {
- diffs.pop(); // Remove the dummy entry at the end.
- } // Second pass: look for single edits surrounded on both sides by equalities
- // which can be shifted sideways to eliminate an equality.
- // e.g: A<ins>BA</ins>C -> <ins>AB</ins>AC
- var changes = false;
- pointer = 1; // Intentionally ignore the first and last element (don't need checking).
- while (pointer < diffs.length - 1) {
- if (diffs[pointer - 1][0] === DIFF_EQUAL && diffs[pointer + 1][0] === DIFF_EQUAL) {
- // This is a single edit surrounded by equalities.
- if (diffs[pointer][1].substring(diffs[pointer][1].length - diffs[pointer - 1][1].length) === diffs[pointer - 1][1]) {
- // Shift the edit over the previous equality.
- diffs[pointer][1] = diffs[pointer - 1][1] + diffs[pointer][1].substring(0, diffs[pointer][1].length - diffs[pointer - 1][1].length);
- diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1];
- diffs.splice(pointer - 1, 1);
- changes = true;
- } else if (diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) == diffs[pointer + 1][1]) {
- // Shift the edit over the next equality.
- diffs[pointer - 1][1] += diffs[pointer + 1][1];
- diffs[pointer][1] = diffs[pointer][1].substring(diffs[pointer + 1][1].length) + diffs[pointer + 1][1];
- diffs.splice(pointer + 1, 1);
- changes = true;
- }
- }
- pointer++;
- } // If shifts were made, the diff needs reordering and another shift sweep.
- if (changes) {
- diff_cleanupMerge(diffs, fix_unicode);
- }
- }
- function is_surrogate_pair_start(charCode) {
- return charCode >= 0xD800 && charCode <= 0xDBFF;
- }
- function is_surrogate_pair_end(charCode) {
- return charCode >= 0xDC00 && charCode <= 0xDFFF;
- }
- function starts_with_pair_end(str) {
- return is_surrogate_pair_end(str.charCodeAt(0));
- }
- function ends_with_pair_start(str) {
- return is_surrogate_pair_start(str.charCodeAt(str.length - 1));
- }
- function remove_empty_tuples(tuples) {
- var ret = [];
- for (var i = 0; i < tuples.length; i++) {
- if (tuples[i][1].length > 0) {
- ret.push(tuples[i]);
- }
- }
- return ret;
- }
- function make_edit_splice(before, oldMiddle, newMiddle, after) {
- if (ends_with_pair_start(before) || starts_with_pair_end(after)) {
- return null;
- }
- return remove_empty_tuples([[DIFF_EQUAL, before], [DIFF_DELETE, oldMiddle], [DIFF_INSERT, newMiddle], [DIFF_EQUAL, after]]);
- }
- function find_cursor_edit_diff(oldText, newText, cursor_pos) {
- // note: this runs after equality check has ruled out exact equality
- var oldRange = typeof cursor_pos === 'number' ? {
- index: cursor_pos,
- length: 0
- } : cursor_pos.oldRange;
- var newRange = typeof cursor_pos === 'number' ? null : cursor_pos.newRange; // take into account the old and new selection to generate the best diff
- // possible for a text edit. for example, a text change from "xxx" to "xx"
- // could be a delete or forwards-delete of any one of the x's, or the
- // result of selecting two of the x's and typing "x".
- var oldLength = oldText.length;
- var newLength = newText.length;
- if (oldRange.length === 0 && (newRange === null || newRange.length === 0)) {
- // see if we have an insert or delete before or after cursor
- var oldCursor = oldRange.index;
- var oldBefore = oldText.slice(0, oldCursor);
- var oldAfter = oldText.slice(oldCursor);
- var maybeNewCursor = newRange ? newRange.index : null;
- editBefore: {
- // is this an insert or delete right before oldCursor?
- var newCursor = oldCursor + newLength - oldLength;
- if (maybeNewCursor !== null && maybeNewCursor !== newCursor) {
- break editBefore;
- }
- if (newCursor < 0 || newCursor > newLength) {
- break editBefore;
- }
- var newBefore = newText.slice(0, newCursor);
- var newAfter = newText.slice(newCursor);
- if (newAfter !== oldAfter) {
- break editBefore;
- }
- var prefixLength = Math.min(oldCursor, newCursor);
- var oldPrefix = oldBefore.slice(0, prefixLength);
- var newPrefix = newBefore.slice(0, prefixLength);
- if (oldPrefix !== newPrefix) {
- break editBefore;
- }
- var oldMiddle = oldBefore.slice(prefixLength);
- var newMiddle = newBefore.slice(prefixLength);
- return make_edit_splice(oldPrefix, oldMiddle, newMiddle, oldAfter);
- }
- editAfter: {
- // is this an insert or delete right after oldCursor?
- if (maybeNewCursor !== null && maybeNewCursor !== oldCursor) {
- break editAfter;
- }
- var cursor = oldCursor;
- var _newBefore = newText.slice(0, cursor);
- var _newAfter = newText.slice(cursor);
- if (_newBefore !== oldBefore) {
- break editAfter;
- }
- var suffixLength = Math.min(oldLength - cursor, newLength - cursor);
- var oldSuffix = oldAfter.slice(oldAfter.length - suffixLength);
- var newSuffix = _newAfter.slice(_newAfter.length - suffixLength);
- if (oldSuffix !== newSuffix) {
- break editAfter;
- }
- var _oldMiddle = oldAfter.slice(0, oldAfter.length - suffixLength);
- var _newMiddle = _newAfter.slice(0, _newAfter.length - suffixLength);
- return make_edit_splice(oldBefore, _oldMiddle, _newMiddle, oldSuffix);
- }
- }
- if (oldRange.length > 0 && newRange && newRange.length === 0) {
- replaceRange: {
- // see if diff could be a splice of the old selection range
- var _oldPrefix = oldText.slice(0, oldRange.index);
- var _oldSuffix = oldText.slice(oldRange.index + oldRange.length);
- var _prefixLength = _oldPrefix.length;
- var _suffixLength = _oldSuffix.length;
- if (newLength < _prefixLength + _suffixLength) {
- break replaceRange;
- }
- var _newPrefix = newText.slice(0, _prefixLength);
- var _newSuffix = newText.slice(newLength - _suffixLength);
- if (_oldPrefix !== _newPrefix || _oldSuffix !== _newSuffix) {
- break replaceRange;
- }
- var _oldMiddle2 = oldText.slice(_prefixLength, oldLength - _suffixLength);
- var _newMiddle2 = newText.slice(_prefixLength, newLength - _suffixLength);
- return make_edit_splice(_oldPrefix, _oldMiddle2, _newMiddle2, _oldSuffix);
- }
- }
- return null;
- }
- function diff(text1, text2, cursor_pos) {
- // only pass fix_unicode=true at the top level, not when diff_main is
- // recursively invoked
- return diff_main(text1, text2, cursor_pos, true);
- }
- diff.INSERT = DIFF_INSERT;
- diff.DELETE = DIFF_DELETE;
- diff.EQUAL = DIFF_EQUAL;
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (diff);
- /***/ }),
- /***/ "./js/util/testConsole.js":
- /*!********************************!*\
- !*** ./js/util/testConsole.js ***!
- \********************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "TestConsole": () => (/* binding */ TestConsole)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _io_domConsole__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../io/domConsole */ "./js/io/domConsole.js");
- /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../services/localizedStringsService */ "./js/services/localizedStringsService.js");
- var LocalizedStrings = (0,_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.getInstance)();
- var TestConsole = /*#__PURE__*/function () {
- function TestConsole(inputList) {
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, TestConsole);
- this.index = 0;
- this.inputList = inputList;
- this.list = [];
- this.currentLine = null;
- }
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(TestConsole, [{
- key: "writeRawHTML",
- value: function writeRawHTML(text) {
- this._appendTextLn(text);
- }
- }, {
- key: "write",
- value: function write(text) {
- var newLine = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- this._appendText(text, _io_domConsole__WEBPACK_IMPORTED_MODULE_2__.DOMConsole.USER, newLine);
- }
- }, {
- key: "info",
- value: function info(text) {
- this._appendTextLn(text, _io_domConsole__WEBPACK_IMPORTED_MODULE_2__.DOMConsole.INFO);
- }
- }, {
- key: "err",
- value: function err(text) {
- this._appendTextLn(text, _io_domConsole__WEBPACK_IMPORTED_MODULE_2__.DOMConsole.ERR);
- }
- }, {
- key: "_appendText",
- value: function _appendText(text, _type) {
- var newLine = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
- if (this.currentLine == null) {
- this.currentLine = this.list.push('') - 1;
- }
- this.list[this.currentLine] += text;
- if (newLine) {
- this.currentLine = null;
- }
- }
- }, {
- key: "_appendTextLn",
- value: function _appendTextLn(text) {
- this.list.push(text);
- this.currentLine = null;
- }
- }, {
- key: "getClassForType",
- value: function getClassForType(type) {
- switch (type) {
- case _io_domConsole__WEBPACK_IMPORTED_MODULE_2__.DOMConsole.USER:
- return "ivprog-term-userText";
- case _io_domConsole__WEBPACK_IMPORTED_MODULE_2__.DOMConsole.INFO:
- return "ivprog-term-info";
- case _io_domConsole__WEBPACK_IMPORTED_MODULE_2__.DOMConsole.ERR:
- return "ivprog-term-error";
- }
- }
- }, {
- key: "requestInput",
- value: function requestInput() {
- var _this = this;
- var promise = new Promise(function (resolve, reject) {
- if (_this.index < _this.inputList.length) {
- resolve(_this.inputList[_this.index]);
- _this.index++;
- } else {
- reject(new Error(LocalizedStrings.getError("exceeded_input_request")));
- }
- });
- return promise;
- }
- }, {
- key: "sendOutput",
- value: function sendOutput(text) {
- var _this2 = this;
- var output = '' + text;
- if (output.indexOf('\n') !== -1) {
- var outputList = output.split('\n');
- var last = outputList.pop();
- outputList.forEach(function (t) {
- t = t.replace(/\t/g, '  ');
- t = t.replace(/\s/g, " ");
- if (t.length == 0) _this2.currentLine = null;else _this2.write(t, true);
- });
- last = last.replace(/\t/g, '  ');
- last = last.replace(/\s/g, " ");
- if (last.length != 0) this.write(last);
- } else {
- output = output.replace(/\t/g, '  ');
- output = output.replace(/\s/g, " ");
- this.write(output);
- }
- }
- }]);
- return TestConsole;
- }();
- /***/ }),
- /***/ "./js/util/utils.js":
- /*!**************************!*\
- !*** ./js/util/utils.js ***!
- \**************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "scrollIt": () => (/* binding */ scrollIt),
- /* harmony export */ "isElementInViewport": () => (/* binding */ isElementInViewport),
- /* harmony export */ "isKeyword": () => (/* binding */ isKeyword),
- /* harmony export */ "isValidIdentifier": () => (/* binding */ isValidIdentifier),
- /* harmony export */ "getCodeEditorModeConfig": () => (/* binding */ getCodeEditorModeConfig),
- /* harmony export */ "levenshteinDistance": () => (/* binding */ levenshteinDistance),
- /* harmony export */ "openAssessmentDetail": () => (/* binding */ openAssessmentDetail),
- /* harmony export */ "range": () => (/* binding */ range),
- /* harmony export */ "sleep": () => (/* binding */ sleep)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js");
- /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js");
- /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "./node_modules/@babel/runtime/helpers/toConsumableArray.js");
- /* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _services_languageService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../services/languageService */ "./js/services/languageService.ts");
- /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
- /* harmony import */ var _ast_operators__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./../ast/operators */ "./js/ast/operators.ts");
- /**
- * source: https://pawelgrzybek.com/page-scroll-in-vanilla-javascript/
- *
- */
- function scrollIt(destination) {
- var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200;
- var easing = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "linear";
- var callback = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
- var easings = {
- linear: function linear(t) {
- return t;
- },
- easeInQuad: function easeInQuad(t) {
- return t * t;
- },
- easeOutQuad: function easeOutQuad(t) {
- return t * (2 - t);
- },
- easeInOutQuad: function easeInOutQuad(t) {
- return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
- },
- easeInCubic: function easeInCubic(t) {
- return t * t * t;
- },
- easeOutCubic: function easeOutCubic(t) {
- return --t * t * t + 1;
- },
- easeInOutCubic: function easeInOutCubic(t) {
- return t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1;
- },
- easeInQuart: function easeInQuart(t) {
- return t * t * t * t;
- },
- easeOutQuart: function easeOutQuart(t) {
- return 1 - --t * t * t * t;
- },
- easeInOutQuart: function easeInOutQuart(t) {
- return t < 0.5 ? 8 * t * t * t * t : 1 - 8 * --t * t * t * t;
- },
- easeInQuint: function easeInQuint(t) {
- return t * t * t * t * t;
- },
- easeOutQuint: function easeOutQuint(t) {
- return 1 + --t * t * t * t * t;
- },
- easeInOutQuint: function easeInOutQuint(t) {
- return t < 0.5 ? 16 * t * t * t * t * t : 1 + 16 * --t * t * t * t * t;
- }
- };
- var start = window.pageYOffset;
- var startTime = "now" in window.performance ? performance.now() : new Date().getTime();
- var documentHeight = Math.max(document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight);
- var windowHeight = window.innerHeight || document.documentElement.clientHeight || document.getElementsByTagName("body")[0].clientHeight;
- var destinationOffset = typeof destination === "number" ? destination : destination.offsetTop;
- var destinationOffsetToScroll = Math.round(documentHeight - destinationOffset < windowHeight ? documentHeight - windowHeight : destinationOffset);
- if ("requestAnimationFrame" in window === false) {
- window.scroll(0, destinationOffsetToScroll);
- if (callback) {
- callback();
- }
- return;
- }
- function scroll() {
- var now = "now" in window.performance ? performance.now() : new Date().getTime();
- var time = Math.min(1, (now - startTime) / duration);
- var timeFunction = easings[easing](time);
- window.scroll(0, Math.ceil(timeFunction * (destinationOffsetToScroll - start) + start));
- if (window.pageYOffset === destinationOffsetToScroll) {
- if (callback) {
- callback();
- }
- return;
- }
- requestAnimationFrame(scroll);
- }
- scroll();
- }
- /**
- *
- * source: https://stackoverflow.com/a/16270434
- */
- function isElementInViewport(el) {
- var rect = el.getBoundingClientRect();
- return rect.bottom > 0 && rect.right > 0 && rect.left < (window.innerWidth || document.documentElement.clientWidth) && rect.top < (window.innerHeight || document.documentElement.clientHeight);
- }
- var cacheMainList = null;
- var cacheOp = null;
- function fillCache() {
- if (cacheMainList == null) {
- cacheMainList = [];
- 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"];
- var lexer = _services_languageService__WEBPACK_IMPORTED_MODULE_3__.LanguageService.getCurrentLexer();
- var names = lexer.getReservedKeys();
- for (var key = 0; key < mainList.length; ++key) {
- var word = mainList[key];
- var keyword = names[word];
- cacheMainList.push(keyword.substring(1, keyword.length - 1));
- }
- }
- if (cacheOp == null) {
- cacheOp = [];
- 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];
- for (var op = 0; op < logicOpList.length; ++op) {
- var lOp = "logic_operator_".concat(logicOpList[op]);
- cacheOp.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_4__.LocalizedStrings.getUI(lOp));
- }
- }
- }
- function isKeyword(text) {
- fillCache();
- for (var key = 0; key < cacheMainList.length; ++key) {
- var keyword = cacheMainList[key];
- if (keyword == text) {
- return true;
- }
- } // not in main list, check op
- for (var op = 0; op < cacheOp.length; op++) {
- var lOp = cacheOp[op];
- if (lOp == text) {
- return true;
- }
- }
- return false;
- }
- function isValidIdentifier(identifier_str) {
- var validRegex = /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(identifier_str);
- if (!validRegex) {
- return false;
- }
- return !isKeyword(identifier_str);
- }
- function getCodeEditorModeConfig() {
- 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"];
- var keywordsList = ["RK_CONST", "RK_RETURN", "RK_BREAK", "RK_FOR_FROM", "RK_FOR_TO", "RK_FOR_PASS", "RK_DO_UNTIL"];
- var typeList = ["RK_REAL", "RK_VOID", "RK_BOOLEAN", "RK_STRING", "RK_INTEGER", "RK_CHARACTER"];
- var atomList = ["RK_FALSE", "RK_TRUE"];
- var case_default = [];
- var blocks = [];
- var keywords = [];
- var types = [];
- var atoms = [];
- var switchString = "";
- cacheMainList = [];
- var lexer = _services_languageService__WEBPACK_IMPORTED_MODULE_3__.LanguageService.getCurrentLexer();
- var names = lexer.getReservedKeys(); //console.debug(names);
- blockList.forEach(function (v) {
- var keyword = names[v];
- var value = keyword.substring(1, keyword.length - 1);
- cacheMainList.push(value);
- keywords.push(value);
- blocks.push(value);
- if (v == "RK_SWITCH") {
- switchString = value;
- } else if (v == "RK_CASE" || v == "RK_DEFAULT") {
- case_default.push(value);
- }
- });
- keywordsList.forEach(function (v) {
- var keyword = names[v];
- var value = keyword.substring(1, keyword.length - 1);
- cacheMainList.push(value);
- keywords.push(value);
- });
- typeList.forEach(function (v) {
- var keyword = names[v];
- var value = keyword.substring(1, keyword.length - 1);
- cacheMainList.push(value);
- types.push(value);
- });
- atomList.forEach(function (v) {
- var keyword = names[v];
- var value = keyword.substring(1, keyword.length - 1);
- cacheMainList.push(value);
- atoms.push(value);
- });
- cacheOp = [];
- var logicOpList = ["NOT_OPERATOR", "OR_OPERATOR", "AND_OPERATOR"];
- logicOpList.forEach(function (v) {
- var keyword = names[v];
- var value = keyword.substring(1, keyword.length - 1);
- cacheOp.push(value);
- keywords.push(value);
- });
- return {
- case_default: case_default,
- atoms: atoms,
- keywords: keywords,
- switchString: switchString,
- types: types,
- blocks: blocks
- };
- }
- /**
- * Source: https://gist.github.com/andrei-m/982927
- * @param {string} a
- * @param {string} b
- */
- function levenshteinDistance(a, b) {
- if (a.length == 0) return b.length;
- if (b.length == 0) return a.length;
- var matrix = []; // increment along the first column of each row
- var i;
- for (i = 0; i <= b.length; i++) {
- matrix[i] = [i];
- } // increment each column in the first row
- var j;
- for (j = 0; j <= a.length; j++) {
- matrix[0][j] = j;
- } // Fill in the rest of the matrix
- for (i = 1; i <= b.length; i++) {
- for (j = 1; j <= a.length; j++) {
- if (b.charCodeAt(i - 1) == a.charCodeAt(j - 1)) {
- matrix[i][j] = matrix[i - 1][j - 1];
- } else {
- matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, // substitution
- Math.min(matrix[i][j - 1] + 1, // insertion
- matrix[i - 1][j] + 1)); // deletion
- }
- }
- }
- return matrix[b.length][a.length];
- }
- var win = null;
- function openAssessmentDetail(event) {
- event.preventDefault();
- var page_code = event.currentTarget.dataset.page;
- if (win != null) {
- win.close();
- }
- win = window.open("", "DetailWindow", "width=550,height=600");
- win.document.open();
- win.document.write(page_code);
- win.document.close();
- }
- function range(size) {
- var startAt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
- return _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_2___default()(Array(size).keys()).map(function (i) {
- return i + startAt;
- });
- }
- /**
- *
- * @param {number} ms
- */
- function sleep(_x) {
- return _sleep.apply(this, arguments);
- }
- function _sleep() {
- _sleep = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee(ms) {
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- return _context.abrupt("return", new Promise(function (res, _) {
- return setTimeout(res, ms);
- }));
- case 1:
- case "end":
- return _context.stop();
- }
- }
- }, _callee);
- }));
- return _sleep.apply(this, arguments);
- }
- /***/ }),
- /***/ "./js/visualUI/algorithm.js":
- /*!**********************************!*\
- !*** ./js/visualUI/algorithm.js ***!
- \**********************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "renderAlgorithm": () => (/* binding */ renderAlgorithm)
- /* harmony export */ });
- /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
- /* harmony import */ var _functions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./functions */ "./js/visualUI/functions.js");
- window.block_render = false;
- function renderAlgorithm() {
- if (window.block_render) {
- return;
- }
- if (window.draging) {
- return;
- }
- window.block_render = true;
- $('.all_functions').children().off();
- $('.all_functions').empty();
- $('.list_globals').children().off();
- $('.list_globals').empty();
- for (var i = 0; i < window.program_obj.functions.length; i++) {
- _functions__WEBPACK_IMPORTED_MODULE_1__.renderFunction(window.program_obj.functions[i]);
- }
- for (var i = 0; i < window.program_obj.globals.length; i++) {
- _globals__WEBPACK_IMPORTED_MODULE_0__.renderGlobal(window.program_obj.globals[i]);
- }
- setTimeout(function () {
- window.block_render = false;
- }, 100);
- if (settingsFilter && settingsFilter[0]) {
- blockAllEditingOptions();
- }
- $('.command_drag').popup({
- content: LocalizedStrings.getUI("text_move_command"),
- delay: {
- show: 1000,
- hide: 0
- }
- });
- }
- /***/ }),
- /***/ "./js/visualUI/code_generator.js":
- /*!***************************************!*\
- !*** ./js/visualUI/code_generator.js ***!
- \***************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "generate": () => (/* binding */ generate),
- /* harmony export */ "repeatNtimesHeader": () => (/* binding */ repeatNtimesHeader),
- /* harmony export */ "elementExpressionCode": () => (/* binding */ elementExpressionCode),
- /* harmony export */ "variableValueMenuCode": () => (/* binding */ variableValueMenuCode)
- /* harmony export */ });
- /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
- /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
- /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
- /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
- /* eslint-disable @typescript-eslint/no-use-before-define */
- /* globals $*/
- function generate() {
- $(".ivprog_visual_panel").find(".error_icon").remove();
- var code = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("program") + " { ";
- code += globalsCode();
- code += "\n";
- var has_error = false;
- for (var i = 0; i < window.program_obj.functions.length; i++) {
- var n_code = functionsCode(window.program_obj.functions[i]);
- if (n_code == null) {
- has_error = true;
- }
- code += n_code;
- code += "\n";
- }
- code += "\n}";
- if (has_error) {
- return null;
- } else {
- return code;
- }
- }
- function functionsCode(function_obj) {
- var ret = "\n\t" + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("function") + " ";
- var has_error = false;
- switch (function_obj.return_type) {
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER:
- ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_integer");
- break;
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL:
- ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_real");
- break;
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT:
- ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_text");
- break;
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN:
- ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_boolean");
- break;
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR:
- ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_char");
- break;
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.VOID:
- ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_void");
- break;
- }
- ret += " ";
- if (function_obj.return_dimensions == 1) {
- ret += "[] ";
- } else if (function_obj.return_dimensions == 2) {
- ret += "[][] ";
- }
- if (function_obj.is_main) {
- ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("start");
- } else {
- ret += function_obj.name;
- }
- ret += " ( ";
- for (var j = 0; j < function_obj.parameters_list.length; j++) {
- ret += parametersCode(function_obj.parameters_list[j]);
- if (j + 1 < function_obj.parameters_list.length) {
- ret += ", ";
- }
- }
- ret += " ) {";
- for (var _j = 0; _j < function_obj.variables_list.length; _j++) {
- ret += variablesCode(function_obj.variables_list[_j]);
- }
- for (var _j2 = 0; _j2 < function_obj.commands.length; _j2++) {
- //try {
- ret += commandsCode(function_obj.commands[_j2]);
- /*} catch (err) {
- has_error = true;
- console.error(err.message);
- var todos = $('body').find('.command_container');
- for (var i = 0; i < todos.length; i++) {
- if ($(todos[i]).data('command') == function_obj.commands[j]) {
- $( todos[i] ).prepend( ' <i class="ui icon red exclamation triangle error_icon"></i> ' );
- break;
- }
- }
- }*/
- }
- ret += "\n\t}";
- if (has_error) {
- return null;
- } else {
- return ret;
- }
- }
- function commandsCode(command_obj) {
- var indentation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
- switch (command_obj.type) {
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES["break"]:
- return breaksCode(command_obj, indentation);
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES.comment:
- return commentsCode(command_obj, indentation);
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES.reader:
- return readersCode(command_obj, indentation);
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES.writer:
- return writersCode(command_obj, indentation);
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES.functioncall:
- return functioncallsCode(command_obj, indentation);
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES.attribution:
- return attributionsCode(command_obj, indentation);
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES.whiletrue:
- return whiletruesCode(command_obj, indentation);
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES.dowhiletrue:
- return doWhilesCode(command_obj, indentation);
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES.iftrue:
- return iftruesCode(command_obj, indentation);
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES.repeatNtimes:
- return repeatNtimesCode(command_obj, indentation);
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES["switch"]:
- return switchsCode(command_obj, indentation);
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES["return"]:
- return returnsCode(command_obj, indentation);
- }
- }
- function returnsCode(command_obj, indentation) {
- var ret = "\n";
- for (var i = 0; i < indentation; i++) {
- ret += "\t";
- }
- ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_return");
- if (command_obj.variable_value_menu) {
- try {
- ret += " " + elementExpressionCode(command_obj.variable_value_menu); //ret += ' ' + variableValueMenuCode(command_obj.variable_value_menu, true);
- } catch (err) {//Empty block
- }
- }
- return ret;
- }
- function breaksCode(_command_obj, indentation) {
- var ret = "\n";
- for (var i = 0; i < indentation; i++) {
- ret += "\t";
- }
- ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_break");
- return ret;
- }
- function switchsCode(command_obj, indentation) {
- var ret = "\n";
- for (var i = 0; i < indentation; i++) {
- ret += "\t";
- }
- ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_code_switch") + " ( ";
- ret += variableValueMenuCode(command_obj.variable);
- ret += " ) { ";
- if (command_obj.cases) {
- for (var _i = 0; _i < command_obj.cases.length; _i++) {
- ret += switchcasesCode(command_obj.cases[_i], indentation + 1);
- }
- }
- ret += "\n";
- for (var _i2 = 0; _i2 < indentation; _i2++) {
- ret += "\t";
- }
- ret += "} ";
- return ret;
- }
- function switchcasesCode(switchcase, indentation) {
- var ret = "\n";
- for (var i = 0; i < indentation; i++) {
- ret += "\t";
- }
- ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_code_case") + " ";
- ret += variableValueMenuCode(switchcase.variable_value_menu);
- ret += " :";
- if (switchcase.commands_block) {
- for (var _i3 = 0; _i3 < switchcase.commands_block.length; _i3++) {
- ret += commandsCode(switchcase.commands_block[_i3], indentation + 1);
- }
- }
- return ret;
- }
- function repeatNtimesHeader(command_obj) {
- var ret = "";
- if (command_obj.var_attribution) {
- ret += '<span class="repeatN_text_par_1">';
- ret += variableValueMenuCode(command_obj.var_attribution);
- ret += '</span>';
- ret += " ".concat(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_code_for_from"), " ");
- ret += '<span class="repeatN_text_par_2">';
- ret += variableValueMenuCode(command_obj.expression1);
- ret += '</span>';
- }
- if (command_obj.expression2) {
- ret += " ".concat(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_code_for_to"), " ");
- ret += '<span class="repeatN_text_par_3">';
- ret += variableValueMenuCode(command_obj.expression2);
- ret += '</span>';
- }
- if (command_obj.expression3) {
- ret += " ".concat(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_code_for_pass"), " ");
- ret += '<span class="repeatN_text_par_4">';
- switch (command_obj.expression3.itens[1]) {
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_TYPES.plus:
- ret += " +";
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_TYPES.minus:
- ret += " -";
- break;
- }
- ret += variableValueMenuCode(command_obj.expression3.itens[2]);
- ret += '</span>';
- }
- return ret;
- }
- function repeatNtimesCode(command_obj, indentation) {
- var ret = "\n";
- for (var i = 0; i < indentation; i++) {
- ret += "\t";
- }
- ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_for") + " ";
- if (command_obj.var_attribution) {
- ret += variableValueMenuCode(command_obj.var_attribution);
- ret += " ".concat(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_code_for_from"), " ");
- ret += variableValueMenuCode(command_obj.expression1);
- }
- if (command_obj.expression2) {
- ret += " ".concat(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_code_for_to"), " ");
- ret += variableValueMenuCode(command_obj.expression2);
- }
- if (command_obj.expression3) {
- ret += " ".concat(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_code_for_pass"), " ");
- switch (command_obj.expression3.itens[1]) {
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_TYPES.plus:
- ret += " +";
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_TYPES.minus:
- ret += " -";
- break;
- }
- ret += variableValueMenuCode(command_obj.expression3.itens[2]);
- }
- ret += " { ";
- if (command_obj.commands_block) {
- for (var _i4 = 0; _i4 < command_obj.commands_block.length; _i4++) {
- ret += commandsCode(command_obj.commands_block[_i4], indentation + 1);
- }
- }
- ret += "\n";
- for (var _i5 = 0; _i5 < indentation; _i5++) {
- ret += "\t";
- }
- ret += "}";
- return ret;
- }
- function iftruesCode(command_obj, indentation) {
- var ret = "\n";
- for (var i = 0; i < indentation; i++) {
- ret += "\t";
- }
- ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_if");
- if (!command_obj.expression) {
- _utils__WEBPACK_IMPORTED_MODULE_3__.renderErrorMessage(command_obj.expression.dom_object, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("inform_valid_expression"));
- } else {
- ret += " ( ";
- ret += elementExpressionCode(command_obj.expression);
- ret += " ) ";
- }
- /*switch (command_obj.expression.expression.type) {
- case Models.EXPRESSION_TYPES.exp_logic:
- ret += logicExpressionCode(command_obj.expression.expression);
- break;
- case Models.EXPRESSION_TYPES.exp_arithmetic:
- ret += arithmeticExpressionCode(command_obj.expression.expression);
- break;
- }*/
- ret += " { ";
- if (command_obj.commands_block) {
- for (var _i6 = 0; _i6 < command_obj.commands_block.length; _i6++) {
- ret += commandsCode(command_obj.commands_block[_i6], indentation + 1);
- }
- }
- ret += "\n";
- for (var _i7 = 0; _i7 < indentation; _i7++) {
- ret += "\t";
- }
- ret += "} " + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_else") + " {";
- if (command_obj.commands_else) {
- for (var _i8 = 0; _i8 < command_obj.commands_else.length; _i8++) {
- ret += commandsCode(command_obj.commands_else[_i8], indentation + 1);
- }
- }
- ret += "\n";
- for (var _i9 = 0; _i9 < indentation; _i9++) {
- ret += "\t";
- }
- ret += "}";
- return ret;
- }
- function doWhilesCode(command_obj, indentation) {
- var ret = "\n";
- for (var i = 0; i < indentation; i++) {
- ret += "\t";
- }
- ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_code_do") + " { ";
- if (command_obj.commands_block) {
- for (var _i10 = 0; _i10 < command_obj.commands_block.length; _i10++) {
- ret += commandsCode(command_obj.commands_block[_i10], indentation + 1);
- }
- }
- ret += "\n";
- for (var _i11 = 0; _i11 < indentation; _i11++) {
- ret += "\t";
- }
- ret += "} " + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_code_do_until");
- if (!command_obj.expression) {
- _utils__WEBPACK_IMPORTED_MODULE_3__.renderErrorMessage(command_obj.expression.dom_object, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("inform_valid_expression"));
- }
- /*switch (command_obj.expression.expression.type) {
- case Models.EXPRESSION_TYPES.exp_logic:
- ret += logicExpressionCode(command_obj.expression.expression);
- break;
- case Models.EXPRESSION_TYPES.exp_arithmetic:
- ret += arithmeticExpressionCode(command_obj.expression.expression);
- break;
- }*/
- if (command_obj.expression) {
- ret += " ( ";
- ret += elementExpressionCode(command_obj.expression);
- ret += " ) ";
- }
- return ret;
- }
- function whiletruesCode(command_obj, indentation) {
- var ret = "\n";
- for (var i = 0; i < indentation; i++) {
- ret += "\t";
- }
- ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_code_while");
- if (!command_obj.expression) {
- _utils__WEBPACK_IMPORTED_MODULE_3__.renderErrorMessage(command_obj.expression.dom_object, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("inform_valid_expression"));
- }
- /*switch (command_obj.expression.expression.type) {
- case Models.EXPRESSION_TYPES.exp_logic:
- ret += logicExpressionCode(command_obj.expression.expression);
- break;
- case Models.EXPRESSION_TYPES.exp_arithmetic:
- ret += arithmeticExpressionCode(command_obj.expression.expression);
- break;
- }*/
- if (command_obj.expression) {
- ret += " ( ";
- ret += elementExpressionCode(command_obj.expression);
- ret += " ) ";
- }
- ret += " { ";
- if (command_obj.commands_block) {
- for (var _i12 = 0; _i12 < command_obj.commands_block.length; _i12++) {
- ret += commandsCode(command_obj.commands_block[_i12], indentation + 1);
- }
- }
- ret += "\n";
- for (var _i13 = 0; _i13 < indentation; _i13++) {
- ret += "\t";
- }
- ret += "}";
- return ret;
- }
- function logicExpressionCode(expression) {
- var ret = " ( ";
- if (expression.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.EXPRESSION_TYPES.exp_logic) {
- ret += logicExpressionCode(expression.first_operand);
- } else if (expression.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.EXPRESSION_TYPES.exp_arithmetic) {
- ret += arithmeticExpressionCode(expression.first_operand);
- } else {
- ret += variableValueMenuCode(expression.first_operand);
- }
- if (expression.operator) {
- switch (expression.operator) {
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.LOGIC_COMPARISON.equals_to:
- ret += " == ";
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.LOGIC_COMPARISON.not_equals_to:
- ret += " != ";
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.LOGIC_COMPARISON.and:
- ret += " && ";
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.LOGIC_COMPARISON.or:
- ret += " || ";
- break;
- }
- if (expression.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.EXPRESSION_TYPES.exp_logic) {
- ret += logicExpressionCode(expression.second_operand);
- } else if (expression.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.EXPRESSION_TYPES.exp_arithmetic) {
- ret += arithmeticExpressionCode(expression.second_operand);
- } else {
- ret += variableValueMenuCode(expression.second_operand);
- }
- }
- ret += " ) ";
- return ret;
- }
- function arithmeticExpressionCode(expression) {
- var ret = " ( ";
- if (expression.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.EXPRESSION_TYPES.exp_logic) {
- ret += logicExpressionCode(expression.first_operand);
- } else if (expression.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.EXPRESSION_TYPES.exp_arithmetic) {
- ret += arithmeticExpressionCode(expression.first_operand);
- } else {
- ret += variableValueMenuCode(expression.first_operand);
- }
- switch (expression.operator) {
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_COMPARISON.greater_than:
- ret += " > ";
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_COMPARISON.less_than:
- ret += " < ";
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_COMPARISON.equals_to:
- ret += " == ";
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_COMPARISON.not_equals_to:
- ret += " != ";
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_COMPARISON.greater_than_or_equals_to:
- ret += " >= ";
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_COMPARISON.less_than_or_equals_to:
- ret += " <= ";
- break;
- }
- if (expression.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.EXPRESSION_TYPES.exp_logic) {
- ret += logicExpressionCode(expression.second_operand);
- } else if (expression.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.EXPRESSION_TYPES.exp_arithmetic) {
- ret += arithmeticExpressionCode(expression.second_operand);
- } else {
- ret += variableValueMenuCode(expression.second_operand);
- }
- ret += " ) ";
- return ret;
- }
- function attributionsCode(command_obj, indentation) {
- var ret = "\n";
- for (var i = 0; i < indentation; i++) {
- ret += "\t";
- }
- ret += variableValueMenuCode(command_obj.variable) + " <- ";
- /*for (var i = 0; i < command_obj.expression.length; i++) {
- ret += elementExpressionCode(command_obj.expression[i]);
- }*/
- ret += elementExpressionCode(command_obj.expression);
- return ret;
- }
- function elementExpressionCode(expression_obj) {
- var ret = "";
- for (var i = 0; i < expression_obj.length; i++) {
- if (expression_obj[i].type) {
- ret += variableValueMenuCode(expression_obj[i]);
- } else if (expression_obj[i].type_op) {
- switch (expression_obj[i].item) {
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_TYPES.plus:
- ret += " + ";
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_TYPES.minus:
- ret += " - ";
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_TYPES.multiplication:
- ret += " * ";
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_TYPES.division:
- ret += " / ";
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_TYPES.module:
- ret += " % ";
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.LOGIC_COMPARISON.equals_to:
- ret += " == ";
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.LOGIC_COMPARISON.not_equals_to:
- ret += " != ";
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.LOGIC_COMPARISON.and:
- ret += " " + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_operator_and") + " ";
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.LOGIC_COMPARISON.or:
- ret += " " + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_operator_or") + " ";
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.LOGIC_COMPARISON.not:
- ret += " " + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_operator_not") + " ";
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_COMPARISON.greater_than:
- ret += " > ";
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_COMPARISON.less_than:
- ret += " < ";
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_COMPARISON.greater_than_or_equals_to:
- ret += " >= ";
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_COMPARISON.less_than_or_equals_to:
- ret += " <= ";
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.EXPRESSION_TYPES.write_sep:
- ret += ', " ", ';
- break;
- }
- } else {
- ret += " " + expression_obj[i] + " ";
- }
- }
- return ret;
- }
- function functioncallsCode(command_obj, indentation) {
- var ret = "\n";
- for (var i = 0; i < indentation; i++) {
- ret += "\t";
- }
- ret += variableValueMenuCode(command_obj.function_called);
- return ret;
- }
- function readersCode(command_obj, indentation) {
- var ret = "\n";
- for (var i = 0; i < indentation; i++) {
- ret += "\t";
- }
- ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_command_read") + " ( ";
- ret += variableValueMenuCode(command_obj.variable_value_menu);
- ret += " ) ";
- return ret;
- }
- function variableValueMenuCode(variable_obj) {
- var is_return = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- var ret = "";
- try {
- if (variable_obj.function_called) {
- if (variable_obj.function_called.name) {
- ret += variable_obj.function_called.name + " ( ";
- } else {
- ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.translateInternalFunction(variable_obj.function_called.identifier, variable_obj.function_called.category) + " ( ";
- }
- if (variable_obj.parameters_list) {
- for (var i = 0; i < variable_obj.parameters_list.length; i++) {
- ret += variableValueMenuCode(variable_obj.parameters_list[i]);
- if (i + 1 < variable_obj.parameters_list.length) {
- ret += ", ";
- }
- }
- }
- ret += " )";
- } else if (variable_obj.content.type) {
- ret += variable_obj.content.name;
- if (variable_obj.content.dimensions == 1 && variable_obj.dimensions != 1) {
- ret += " [ " + variableValueMenuCode(variable_obj.column) + " ] ";
- }
- if (variable_obj.content.dimensions == 2 && variable_obj.dimensions != 2 && variable_obj.reference_dimensions == 1) {
- ret += " [ " + variableValueMenuCode(variable_obj.row) + " ] ";
- } else if (variable_obj.content.dimensions == 2 && variable_obj.dimensions != 2) {
- ret += " [ " + variableValueMenuCode(variable_obj.row) + " ] ";
- ret += " [ " + variableValueMenuCode(variable_obj.column) + " ] ";
- }
- } else {
- var content = String(variable_obj.content);
- if (isNaN(content)) {
- // console.debug("Content length: ", content.length);
- // console.debug("Char code at 0", content.charCodeAt(0));
- var isBackslash = content.charCodeAt(0) === 92;
- if (content.length === 1 || content.length === 2 && isBackslash) {
- ret += "'".concat(content, "'");
- } else {
- ret += '"' + variable_obj.content + '"';
- }
- } else if (content.length == 0) {
- ret += '""';
- } else if (content.trim().length == 0) {
- ret += '"' + content + '"';
- } else {
- ret += variable_obj.content;
- }
- }
- } catch (err) {
- if (!is_return) {
- _utils__WEBPACK_IMPORTED_MODULE_3__.renderErrorMessage(variable_obj.dom_object, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("inform_valid_content"));
- throw err;
- }
- }
- return ret;
- }
- function writersCode(command_obj, indentation) {
- var ret = "\n";
- for (var i = 0; i < indentation; i++) {
- ret += "\t";
- }
- ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_command_write") + " ( ";
- /*for (var i = 0; i < command_obj.content.length; i++) {
- ret += variableValueMenuCode(command_obj.content[i]);
- if ((i + 1) < command_obj.content.length) {
- ret += ' + ';
- }
- }*/
- ret += elementExpressionCode(command_obj.content);
- if (command_obj.newline) {
- ret += ', "\\n"';
- }
- ret += " ) ";
- return ret;
- }
- function commentsCode(command_obj, indentation) {
- var ret = "\n";
- for (var i = 0; i < indentation; i++) {
- ret += "\t";
- }
- ret += "// ";
- ret += command_obj.comment_text.content;
- return ret;
- }
- function parametersCode(parameter_obj) {
- var ret = "";
- switch (parameter_obj.type) {
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER:
- ret += " " + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_integer") + " ";
- break;
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL:
- ret += " " + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_real") + " ";
- break;
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT:
- ret += " " + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_text") + " ";
- break;
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN:
- ret += " " + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_boolean") + " ";
- break;
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR:
- ret += " " + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_char") + " ";
- break;
- }
- if (parameter_obj.reference) ret += "&";
- ret += parameter_obj.name + "";
- if (parameter_obj.dimensions == 1) {
- ret += " []";
- } else if (parameter_obj.dimensions == 2) {
- ret += " [][]";
- }
- return ret;
- }
- function variablesCode(variable_obj) {
- var ret = "";
- var temp = variable_obj;
- ret += "\n\t\t";
- if (temp.is_constant) {
- ret += "const ";
- }
- switch (temp.type) {
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER:
- ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_integer") + " ";
- break;
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL:
- ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_real") + " ";
- break;
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT:
- ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_text") + " ";
- break;
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN:
- ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_boolean") + " ";
- break;
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR:
- ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_char") + " ";
- break;
- }
- ret += temp.name + " ";
- if (temp.dimensions == 1) {
- ret += "[" + temp.columns + "] ";
- switch (temp.type) {
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER:
- ret += "<- {";
- for (var j = 0; j < temp.value.length; j++) {
- ret += temp.value[j];
- if (j + 1 < temp.value.length) {
- ret += ", ";
- }
- }
- ret += "}";
- break;
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL:
- ret += "<- {";
- for (var _j3 = 0; _j3 < temp.value.length; _j3++) {
- ret += parseFloat(temp.value[_j3]).toFixed(2);
- if (_j3 + 1 < temp.value.length) {
- ret += ", ";
- }
- }
- ret += "}";
- break;
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT:
- ret += "<- {";
- for (var _j4 = 0; _j4 < temp.value.length; _j4++) {
- ret += '"' + temp.value[_j4] + '"';
- if (_j4 + 1 < temp.value.length) {
- ret += ", ";
- }
- }
- ret += "}";
- break;
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN:
- ret += "<- {";
- for (var _j5 = 0; _j5 < temp.value.length; _j5++) {
- if (temp.value[_j5]) {
- ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_true");
- } else {
- ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_false");
- }
- if (_j5 + 1 < temp.value.length) {
- ret += ", ";
- }
- }
- ret += "}";
- break;
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR:
- ret += "<- {";
- for (var _j6 = 0; _j6 < temp.value.length; _j6++) {
- ret += "'" + temp.value[_j6] + "'";
- if (_j6 + 1 < temp.value.length) {
- ret += ", ";
- }
- }
- ret += "}";
- break;
- }
- } else if (temp.dimensions == 2) {
- ret += "[" + temp.rows + "][" + temp.columns + "] ";
- switch (temp.type) {
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER:
- ret += "<- {";
- for (var _j7 = 0; _j7 < temp.rows; _j7++) {
- ret += "{";
- for (var k = 0; k < temp.columns; k++) {
- ret += temp.value[_j7][k];
- if (k + 1 < temp.columns) {
- ret += ", ";
- }
- }
- ret += "}";
- if (_j7 + 1 < temp.rows) {
- ret += ", ";
- }
- }
- ret += "}";
- break;
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL:
- ret += "<- {";
- for (var _j8 = 0; _j8 < temp.rows; _j8++) {
- ret += "{";
- for (var _k = 0; _k < temp.columns; _k++) {
- ret += parseFloat(temp.value[_j8][_k]).toFixed(2);
- if (_k + 1 < temp.columns) {
- ret += ", ";
- }
- }
- ret += "}";
- if (_j8 + 1 < temp.rows) {
- ret += ", ";
- }
- }
- ret += "}";
- break;
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT:
- ret += "<- {";
- for (var _j9 = 0; _j9 < temp.rows; _j9++) {
- ret += "{";
- for (var _k2 = 0; _k2 < temp.columns; _k2++) {
- ret += '"' + temp.value[_j9][_k2] + '"';
- if (_k2 + 1 < temp.columns) {
- ret += ", ";
- }
- }
- ret += "}";
- if (_j9 + 1 < temp.rows) {
- ret += ", ";
- }
- }
- ret += "}";
- break;
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN:
- ret += "<- {";
- for (var _j10 = 0; _j10 < temp.rows; _j10++) {
- ret += "{";
- for (var _k3 = 0; _k3 < temp.columns; _k3++) {
- if (temp.value[_j10][_k3]) {
- ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_true");
- } else {
- ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_false");
- }
- if (_k3 + 1 < temp.columns) {
- ret += ", ";
- }
- }
- ret += "}";
- if (_j10 + 1 < temp.rows) {
- ret += ", ";
- }
- }
- ret += "}";
- break;
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR:
- ret += "<- {";
- for (var _j11 = 0; _j11 < temp.rows; _j11++) {
- ret += "{";
- for (var _k4 = 0; _k4 < temp.columns; _k4++) {
- ret += "'" + temp.value[_j11][_k4] + "'";
- if (_k4 + 1 < temp.columns) {
- ret += ", ";
- }
- }
- ret += "}";
- if (_j11 + 1 < temp.rows) {
- ret += ", ";
- }
- }
- ret += "}";
- break;
- }
- } else {
- switch (temp.type) {
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER:
- ret += "<- " + temp.value;
- break;
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL:
- ret += "<- " + parseFloat(temp.value).toFixed(2);
- break;
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT:
- ret += '<- "' + temp.value + '"';
- break;
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN:
- ret += "<- ";
- if (temp.value) {
- ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_true");
- } else {
- ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_false");
- }
- break;
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR:
- ret += "<- '" + temp.value + "'";
- break;
- }
- }
- return ret;
- }
- function globalsCode() {
- var ret = "";
- if (window.program_obj.globals) {
- for (var i = 0; i < window.program_obj.globals.length; i++) {
- var temp = window.program_obj.globals[i];
- ret += "\n\t";
- if (temp.is_constant) {
- ret += "const ";
- }
- switch (temp.type) {
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER:
- ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_integer");
- break;
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL:
- ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_real");
- break;
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT:
- ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_text");
- break;
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN:
- ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_boolean");
- break;
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR:
- ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_char");
- break;
- }
- ret += " " + temp.name + " ";
- if (temp.dimensions == 1) {
- ret += "[" + temp.columns + "] ";
- switch (temp.type) {
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER:
- ret += "<- {";
- for (var j = 0; j < temp.value.length; j++) {
- ret += temp.value[j];
- if (j + 1 < temp.value.length) {
- ret += ", ";
- }
- }
- ret += "}";
- break;
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL:
- ret += "<- {";
- for (var _j12 = 0; _j12 < temp.value.length; _j12++) {
- ret += parseFloat(temp.value[_j12]).toFixed(2);
- if (_j12 + 1 < temp.value.length) {
- ret += ", ";
- }
- }
- ret += "}";
- break;
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT:
- ret += "<- {";
- for (var _j13 = 0; _j13 < temp.value.length; _j13++) {
- ret += '"' + temp.value[_j13] + '"';
- if (_j13 + 1 < temp.value.length) {
- ret += ", ";
- }
- }
- ret += "}";
- break;
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN:
- ret += "<- {";
- for (var _j14 = 0; _j14 < temp.value.length; _j14++) {
- if (temp.value[_j14]) {
- ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_true");
- } else {
- ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_false");
- }
- if (_j14 + 1 < temp.value.length) {
- ret += ", ";
- }
- }
- ret += "}";
- break;
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR:
- ret += "<- {";
- for (var _j15 = 0; _j15 < temp.value.length; _j15++) {
- ret += "'" + temp.value[_j15] + "'";
- if (_j15 + 1 < temp.value.length) {
- ret += ", ";
- }
- }
- ret += "}";
- break;
- }
- } else if (temp.dimensions == 2) {
- ret += "[" + temp.rows + "][" + temp.columns + "] ";
- switch (temp.type) {
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER:
- ret += "<- {";
- for (var _j16 = 0; _j16 < temp.rows; _j16++) {
- ret += "{";
- for (var k = 0; k < temp.columns; k++) {
- ret += temp.value[_j16][k];
- if (k + 1 < temp.columns) {
- ret += ", ";
- }
- }
- ret += "}";
- if (_j16 + 1 < temp.rows) {
- ret += ", ";
- }
- }
- ret += "}";
- break;
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL:
- ret += "<- {";
- for (var _j17 = 0; _j17 < temp.rows; _j17++) {
- ret += "{";
- for (var _k5 = 0; _k5 < temp.columns; _k5++) {
- ret += parseFloat(temp.value[_j17][_k5]).toFixed(2);
- if (_k5 + 1 < temp.columns) {
- ret += ", ";
- }
- }
- ret += "}";
- if (_j17 + 1 < temp.rows) {
- ret += ", ";
- }
- }
- ret += "}";
- break;
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT:
- ret += "<- {";
- for (var _j18 = 0; _j18 < temp.rows; _j18++) {
- ret += "{";
- for (var _k6 = 0; _k6 < temp.columns; _k6++) {
- ret += '"' + temp.value[_j18][_k6] + '"';
- if (_k6 + 1 < temp.columns) {
- ret += ", ";
- }
- }
- ret += "}";
- if (_j18 + 1 < temp.rows) {
- ret += ", ";
- }
- }
- ret += "}";
- break;
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN:
- ret += "<- {";
- for (var _j19 = 0; _j19 < temp.rows; _j19++) {
- ret += "{";
- for (var _k7 = 0; _k7 < temp.columns; _k7++) {
- if (temp.value[_j19][_k7]) {
- ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_true");
- } else {
- ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_false");
- }
- if (_k7 + 1 < temp.columns) {
- ret += ", ";
- }
- }
- ret += "}";
- if (_j19 + 1 < temp.rows) {
- ret += ", ";
- }
- }
- ret += "}";
- break;
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR:
- ret += "<- {";
- for (var _j20 = 0; _j20 < temp.rows; _j20++) {
- ret += "{";
- for (var _k8 = 0; _k8 < temp.columns; _k8++) {
- ret += "'" + temp.value[_j20][_k8] + "'";
- if (_k8 + 1 < temp.columns) {
- ret += ", ";
- }
- }
- ret += "}";
- if (_j20 + 1 < temp.rows) {
- ret += ", ";
- }
- }
- ret += "}";
- break;
- }
- } else {
- switch (temp.type) {
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER:
- ret += "<- " + temp.value;
- break;
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL:
- ret += "<- " + parseFloat(temp.value).toFixed(2);
- break;
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT:
- ret += '<- "' + temp.value + '"';
- break;
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN:
- ret += "<- ";
- if (temp.value) {
- ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_true");
- } else {
- ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_false");
- }
- break;
- case _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR:
- ret += "<- '" + temp.value + "'";
- break;
- }
- }
- }
- }
- return ret;
- }
- /***/ }),
- /***/ "./js/visualUI/commands.js":
- /*!*********************************!*\
- !*** ./js/visualUI/commands.js ***!
- \*********************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "removeCommand": () => (/* binding */ removeCommand),
- /* harmony export */ "createFloatingCommand": () => (/* binding */ createFloatingCommand),
- /* harmony export */ "renderCommand": () => (/* binding */ renderCommand),
- /* harmony export */ "genericCreateCommand": () => (/* binding */ genericCreateCommand)
- /* harmony export */ });
- /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
- /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
- /* harmony import */ var _commands_comment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./commands/comment */ "./js/visualUI/commands/comment.js");
- /* harmony import */ var _commands_reader__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./commands/reader */ "./js/visualUI/commands/reader.js");
- /* harmony import */ var _commands_writer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./commands/writer */ "./js/visualUI/commands/writer.js");
- /* harmony import */ var _commands_attribution__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./commands/attribution */ "./js/visualUI/commands/attribution.js");
- /* harmony import */ var _commands_iftrue__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./commands/iftrue */ "./js/visualUI/commands/iftrue.js");
- /* harmony import */ var _commands_repeatNtimes__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./commands/repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
- /* harmony import */ var _commands_whiletrue__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./commands/whiletrue */ "./js/visualUI/commands/whiletrue.js");
- /* harmony import */ var _commands_dowhiletrue__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./commands/dowhiletrue */ "./js/visualUI/commands/dowhiletrue.js");
- /* harmony import */ var _commands_switch__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./commands/switch */ "./js/visualUI/commands/switch.js");
- /* harmony import */ var _commands_functioncall__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./commands/functioncall */ "./js/visualUI/commands/functioncall.js");
- /* harmony import */ var _commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
- /* harmony import */ var _commands_break__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./commands/break */ "./js/visualUI/commands/break.js");
- /* harmony import */ var _commands_return__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./commands/return */ "./js/visualUI/commands/return.js");
- /* harmony import */ var _services_userLog__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./../services/userLog */ "./js/services/userLog.js");
- // let has_element_created_draged = false;
- // let which_element_is_draged = null;
- function removeCommand(command, function_obj, dom_obj) {
- (0,_services_userLog__WEBPACK_IMPORTED_MODULE_15__.registerUserEvent)(function_obj.name, _services_userLog__WEBPACK_IMPORTED_MODULE_15__.ActionTypes.REMOVE_COMMAND, command.type, '/', 0);
- if (function_obj.commands.indexOf(command) > -1) {
- function_obj.commands.splice(function_obj.commands.indexOf(command), 1);
- return true;
- } // Utilize dois parantNode, pois o primeiro é o div de comandos
- try {
- if (dom_obj.parent().parent().data('command').commands_block.indexOf(command) > -1) {
- dom_obj.parent().parent().data('command').commands_block.splice(dom_obj.parent().parent().data('command').commands_block.indexOf(command), 1);
- return true;
- }
- } catch (err) {}
- try {
- if (dom_obj.parent().parent().data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.iftrue) {
- if (dom_obj.parent().parent().data('command').commands_else.indexOf(command) > -1) {
- dom_obj.parent().parent().data('command').commands_else.splice(dom_obj.parent().parent().data('command').commands_else.indexOf(command), 1);
- return true;
- }
- }
- } catch (err) {}
- if (dom_obj.parent().data('switchcase')) {
- dom_obj.parent().data('switchcase').commands_block.splice(dom_obj.parent().data('switchcase').commands_block.indexOf(command), 1);
- return true;
- }
- return false;
- }
- window.function_container_active = null;
- function createFloatingCommand(function_obj, function_container, command_type, mouse_event) {
- var floatingObject;
- switch (command_type) {
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["break"]:
- floatingObject = _commands_break__WEBPACK_IMPORTED_MODULE_13__.createFloatingCommand();
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.comment:
- floatingObject = _commands_comment__WEBPACK_IMPORTED_MODULE_2__.createFloatingCommand();
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.reader:
- floatingObject = _commands_reader__WEBPACK_IMPORTED_MODULE_3__.createFloatingCommand();
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.writer:
- floatingObject = _commands_writer__WEBPACK_IMPORTED_MODULE_4__.createFloatingCommand();
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.attribution:
- floatingObject = _commands_attribution__WEBPACK_IMPORTED_MODULE_5__.createFloatingCommand();
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.iftrue:
- floatingObject = _commands_iftrue__WEBPACK_IMPORTED_MODULE_6__.createFloatingCommand();
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.repeatNtimes:
- floatingObject = _commands_repeatNtimes__WEBPACK_IMPORTED_MODULE_7__.createFloatingCommand();
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.whiletrue:
- floatingObject = _commands_whiletrue__WEBPACK_IMPORTED_MODULE_8__.createFloatingCommand();
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.dowhiletrue:
- floatingObject = _commands_dowhiletrue__WEBPACK_IMPORTED_MODULE_9__.createFloatingCommand();
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["switch"]:
- floatingObject = _commands_switch__WEBPACK_IMPORTED_MODULE_10__.createFloatingCommand();
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.functioncall:
- floatingObject = _commands_functioncall__WEBPACK_IMPORTED_MODULE_11__.createFloatingCommand();
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["return"]:
- floatingObject = _commands_return__WEBPACK_IMPORTED_MODULE_14__.createFloatingCommand();
- break;
- }
- floatingObject.draggable().appendTo("body");
- $('body').mouseup(function (evt) {
- manageCommand(function_obj, function_container, evt, command_type);
- $('body').off('mouseup');
- $('body').off('mouseover');
- });
- if (!function_container.hasClass('function_div') || function_container.length < 1) {
- window.mouse_event = mouse_event;
- function_container = $(mouse_event.originalEvent.srcElement.closest('.function_div'));
- }
- function_container_active = function_container;
- function_container.find('.commands_list_div').on('mousemove', function (evt) {
- addGhostDiv(evt);
- });
- function_container.find('.commands_list_div').find("*").on('mousemove', function (evt) {
- addGhostDiv(evt);
- });
- function_container.on('mouseout', function (event) {
- var el = $(document.elementFromPoint(event.clientX, event.clientY));
- if (el.closest('.commands_list_div').length < 1) {
- window.ghostDiv.remove();
- }
- });
- floatingObject.css("position", "absolute");
- mouse_event.type = "mousedown.draggable";
- mouse_event.target = floatingObject[0];
- floatingObject.css("left", mouse_event.pageX - window.divx);
- floatingObject.css("top", mouse_event.pageY);
- floatingObject.trigger(mouse_event);
- }
- window.divx = 100;
- window.ghostDiv = $('<div class="ghost_div">');
- window.active_container = null;
- function addGhostToEmptyBlock(element, evt) {
- $('.ghost_div').remove();
- var container = element.closest('.command_container');
- if (container.hasClass('switch')) {
- container = $(evt.target).closest('.case_div');
- }
- if (!container.hasClass('dowhiletrue') && !container.hasClass('iftrue') && !container.hasClass('repeatNtimes') && !container.hasClass('case_div') && !container.hasClass('whiletrue')) {
- addGhostToNotEmptyBlock(element, evt);
- return;
- }
- if (window.active_container != null) {
- if (window.active_container.is(container)) {//console.log('é o mesmo, não mudou!');
- } else {
- if (container.length < 1) {
- container = element.closest('.commands_list_div');
- if (window.active_container.is(container)) {//console.log('é o mesmo command list');
- } else {
- //console.log('mudou para um command list');
- window.active_container = container;
- }
- } else {//console.log('mudou para um outro container?');
- }
- }
- }
- window.active_container = container;
- if (container.hasClass('iftrue')) {
- var containerIf = container.find('.commands_if').get(0);
- var containerElse = container.find('.commands_else').get(0);
- var topIfDistance = Math.abs(evt.clientY - containerIf.getBoundingClientRect().top);
- var bottomIfDistance = Math.abs(containerIf.getBoundingClientRect().top + containerIf.getBoundingClientRect().height - evt.clientY);
- var topElseDistance = Math.abs(evt.clientY - containerElse.getBoundingClientRect().top);
- var bottomElseDistance = Math.abs(containerElse.getBoundingClientRect().top + containerElse.getBoundingClientRect().height - evt.clientY);
- if (topIfDistance < topElseDistance && topIfDistance < bottomElseDistance) {
- $(containerIf).append(window.ghostDiv);
- } else {
- $(containerElse).append(window.ghostDiv);
- }
- } else if (container.hasClass('case_div')) {
- container.find('.case_commands_block').append(window.ghostDiv);
- } else {
- container.find('.block_commands').append(window.ghostDiv);
- }
- }
- function addGhostToNotEmptyBlock(element, evt) {
- $('.ghost_div').remove();
- var container = element.closest('.dowhiletrue, .iftrue, .repeatNtimes, .case_div, .whiletrue'); //console.log("\n\nNOT EMPTY: ", container);
- //if (window.active_container != null) {
- //}
- if (container.length < 1) {
- container = element.closest('.commands_list_div');
- window.active_container = container;
- addGhostToFunctionArea(element, evt);
- } else {//console.log('mudou para um outro container?');
- }
- window.active_container = container; // quem está mais próximo? // Essa regra se aplica somente quando o over está sobre um comando
- var allfilhos;
- if (container.hasClass('iftrue')) {
- if ($(evt.target).closest('.data_block_if').length > 0) {
- allfilhos = container.find('.commands_if').children('.command_container');
- } else if ($(evt.target).closest('.data_block_else').length > 0) {
- allfilhos = container.find('.commands_else').children('.command_container');
- } else {
- var containerIf = container.find('.commands_if').get(0);
- var containerElse = container.find('.commands_else').get(0);
- var topIfDistance = Math.abs(evt.clientY - containerIf.getBoundingClientRect().top);
- var bottomIfDistance = Math.abs(containerIf.getBoundingClientRect().top + containerIf.getBoundingClientRect().height - evt.clientY);
- var topElseDistance = Math.abs(evt.clientY - containerElse.getBoundingClientRect().top);
- var bottomElseDistance = Math.abs(containerElse.getBoundingClientRect().top + containerElse.getBoundingClientRect().height - evt.clientY);
- if (topIfDistance < topElseDistance && topIfDistance < bottomElseDistance) {
- allfilhos = $(containerIf).children('.command_container');
- } else {
- allfilhos = $(containerElse).children('.command_container');
- }
- }
- } else if (container.hasClass('case_div')) {
- allfilhos = container.children('.case_commands_block').children('.command_container');
- } else if (container.hasClass('commands_list_div')) {
- allfilhos = container.children('.command_container');
- } else {
- allfilhos = container.children('.block_commands').children('.command_container');
- }
- var topDistances = [];
- var bottomDistances = [];
- for (var i = 0; i < allfilhos.length; i++) {
- var topD = Math.abs(evt.clientY - allfilhos.get(i).getBoundingClientRect().top);
- topDistances.push(topD);
- var botD = Math.abs(allfilhos.get(i).getBoundingClientRect().top + allfilhos.get(i).getBoundingClientRect().height - evt.clientY);
- bottomDistances.push(botD);
- }
- var menorTop = Math.min.apply(null, topDistances);
- var indiceTop = topDistances.indexOf(menorTop);
- var menorBot = Math.min.apply(null, bottomDistances);
- var indiceBot = bottomDistances.indexOf(menorBot);
- if (menorTop < menorBot) {
- window.ghostDiv.insertBefore($(allfilhos.get(indiceTop)));
- } else {
- window.ghostDiv.insertAfter($(allfilhos.get(indiceBot)));
- }
- }
- function addGhostToFunctionArea(undermouse, evt) {
- $('.ghost_div').remove();
- var allfilhos = undermouse.closest('.commands_list_div').children('.command_container');
- var topDistances = [];
- var bottomDistances = [];
- for (var i = 0; i < allfilhos.length; i++) {
- var topD = Math.abs(evt.clientY - allfilhos.get(i).getBoundingClientRect().top);
- topDistances.push(topD);
- var botD = Math.abs(allfilhos.get(i).getBoundingClientRect().top + allfilhos.get(i).getBoundingClientRect().height - evt.clientY);
- bottomDistances.push(botD);
- }
- var menorTop = Math.min.apply(null, topDistances);
- var indiceTop = topDistances.indexOf(menorTop);
- var menorBot = Math.min.apply(null, bottomDistances);
- var indiceBot = bottomDistances.indexOf(menorBot);
- if (menorTop < menorBot) {
- window.ghostDiv.insertBefore($(allfilhos.get(indiceTop)));
- } else {
- window.ghostDiv.insertAfter($(allfilhos.get(indiceBot)));
- }
- }
- function addGhostDiv(evt) {
- var undermouse = $(evt.target);
- if (undermouse.hasClass('ghost_div')) {
- return;
- } else if (undermouse.hasClass('commands_list_div')) {
- addGhostToFunctionArea(undermouse, evt);
- return;
- } else if (undermouse.hasClass('block_commands')) {
- if (undermouse.find('.command_container').length > 0) {
- addGhostToNotEmptyBlock(undermouse, evt);
- } else {
- addGhostToEmptyBlock(undermouse, evt);
- }
- } else if (undermouse.hasClass('case_div')) {
- if (undermouse.find('.case_commands_block').find('.command_container').length > 0) {
- addGhostToNotEmptyBlock(undermouse, evt);
- } else {
- addGhostToEmptyBlock(undermouse, evt);
- }
- } else {
- addGhostToNotEmptyBlock(undermouse, evt);
- }
- }
- function borderMouseDragCommand(function_obj, function_container, evt) {
- function_container.find('.over_command_drag').each(function (index) {
- $(this).removeClass('over_command_drag');
- });
- var prev = null;
- function_container.find('.commands_list_div').each(function (index) {
- prev = $(this);
- if (prev) {
- var objLeft = prev.offset().left;
- var objTop = prev.offset().top;
- var objRight = objLeft + prev.width();
- var objBottom = objTop + prev.height();
- if (evt.pageX > objLeft && evt.pageX < objRight && evt.pageY > objTop && evt.pageY < objBottom) {
- prev.addClass("over_command_drag");
- }
- }
- });
- function_container.find('.command_container').each(function (index) {
- var obj = $(this);
- var objLeft = obj.offset().left;
- var objTop = obj.offset().top;
- var objRight = objLeft + obj.width();
- var objBottom = objTop + obj.height();
- if (evt.pageX > objLeft && evt.pageX < objRight && evt.pageY > objTop && evt.pageY < objBottom) {
- if (prev) {
- prev.removeClass('over_command_drag');
- }
- obj.addClass("over_command_drag");
- return;
- }
- });
- } // before_after_inside: 1 -> before, 2 -> after, 3 -> inside
- function renderCommand(command, element_reference, before_after_inside, function_obj) {
- var createdElement;
- switch (command.type) {
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.comment:
- createdElement = _commands_comment__WEBPACK_IMPORTED_MODULE_2__.renderCommand(command, function_obj);
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["break"]:
- createdElement = _commands_break__WEBPACK_IMPORTED_MODULE_13__.renderCommand(command, function_obj);
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.reader:
- createdElement = _commands_reader__WEBPACK_IMPORTED_MODULE_3__.renderCommand(command, function_obj);
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.writer:
- createdElement = _commands_writer__WEBPACK_IMPORTED_MODULE_4__.renderCommand(command, function_obj);
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.attribution:
- createdElement = _commands_attribution__WEBPACK_IMPORTED_MODULE_5__.renderCommand(command, function_obj);
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.functioncall:
- createdElement = _commands_functioncall__WEBPACK_IMPORTED_MODULE_11__.renderCommand(command, function_obj);
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.iftrue:
- createdElement = _commands_iftrue__WEBPACK_IMPORTED_MODULE_6__.renderCommand(command, function_obj);
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.repeatNtimes:
- createdElement = _commands_repeatNtimes__WEBPACK_IMPORTED_MODULE_7__.renderCommand(command, function_obj);
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.whiletrue:
- createdElement = _commands_whiletrue__WEBPACK_IMPORTED_MODULE_8__.renderCommand(command, function_obj);
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.dowhiletrue:
- createdElement = _commands_dowhiletrue__WEBPACK_IMPORTED_MODULE_9__.renderCommand(command, function_obj);
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["switch"]:
- createdElement = _commands_switch__WEBPACK_IMPORTED_MODULE_10__.renderCommand(command, function_obj);
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["return"]:
- createdElement = _commands_return__WEBPACK_IMPORTED_MODULE_14__.renderCommand(command, function_obj);
- break;
- }
- switch (before_after_inside) {
- case 1:
- createdElement.insertBefore(element_reference);
- break;
- case 2:
- createdElement.insertAfter(element_reference);
- break;
- case 3:
- element_reference.append(createdElement);
- break;
- }
- }
- function genericCreateCommand(command_type) {
- switch (command_type) {
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["break"]:
- return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.Break();
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.comment:
- 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));
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.reader:
- 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));
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.writer:
- 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)]);
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.attribution:
- 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), []);
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.functioncall:
- 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);
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.iftrue:
- 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)]);
- //(var_attribution, var_incrementation, expression1, expression2, expression3, commands_block)
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.repeatNtimes:
- 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);
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.whiletrue:
- 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);
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.dowhiletrue:
- 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);
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["switch"]:
- 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))];
- 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);
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["return"]:
- 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)]);
- }
- }
- function dragTrash(event) {
- $('.ghost_div').remove();
- var trash = $('<i class="ui icon trash alternate outline"></i>');
- $('body').append(trash);
- trash.css('position', 'absolute');
- trash.css('top', event.clientY);
- trash.css('left', event.clientX - 20);
- trash.css('font-size', '3em');
- trash.css('display', 'none');
- function_container_active.find('.commands_list_div').off('mousemove');
- function_container_active.find('.commands_list_div').find("*").off('mousemove');
- trash.fadeIn(200, function () {
- trash.fadeOut(200, function () {
- trash.remove();
- });
- });
- }
- function findSingleElement(searching, query) {
- if (!searching || !query) {
- return '';
- }
- 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) {
- if (searching.commands_block) {
- return '' + searching.commands_block.indexOf(query);
- } else {
- return '0';
- }
- } else if (searching.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.iftrue) {
- if (searching.commands_block == null) {
- searching.commands_block = [];
- }
- if (searching.commands_else == null) {
- searching.commands_else = [];
- }
- if (searching.commands_block.indexOf(query) >= 0) {
- return 'if[' + searching.commands_block.indexOf(query) + ']';
- } else {
- return 'else[' + searching.commands_else.indexOf(query) + ']';
- }
- } else if (searching.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["switch"]) {
- for (var i = 0; i < searching.cases.length; i++) {
- if (searching.cases[i].commands_block.indexOf(query) >= 0) {
- return 'case[' + searching.cases[i].commands_block.indexOf(query) + ']';
- }
- }
- }
- }
- function findPathRecursive(starter_index, hierarquia_bottom_up, function_obj) {
- var index_command = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : -1;
- var actual = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
- var full_path = '';
- for (var i = 0; i <= hierarquia_bottom_up.length; i++) {
- full_path += findSingleElement(hierarquia_bottom_up[i], hierarquia_bottom_up[i + 1]) + '-';
- }
- return full_path;
- }
- function manageCommand(function_obj, function_container, event, command_type) {
- $(".created_element").each(function (index) {
- $(this).remove();
- });
- var el = $(document.elementFromPoint(event.clientX, event.clientY));
- if (el.hasClass('ghost_div')) {
- if (el.closest('.command_container').length < 1) {
- el.closest('.commands_list_div').css('height', el.closest('.commands_list_div').css('height') + 30); //$('.ghost_div').remove();
- el = el.closest('.commands_list_div');
- }
- } // Primeiro verificar se ele soltou no espaço da função correta:
- var hier = el.parentsUntil(".all_functions");
- var esta_correto = false;
- var esta_na_div_correta = false;
- if (el.hasClass("commands_list_div")) {
- esta_na_div_correta = true;
- }
- for (var i = 0; i < hier.length; i++) {
- var temp = $(hier[i]);
- if (temp.hasClass("commands_list_div")) {
- esta_na_div_correta = true;
- }
- if (temp.data('fun') == function_obj) {
- esta_correto = true;
- break;
- }
- }
- if (!esta_correto) {
- // has_element_created_draged = false;
- // which_element_is_draged = null;
- dragTrash(event);
- return;
- } else {
- if (!esta_na_div_correta) {
- // has_element_created_draged = false;
- // which_element_is_draged = null;
- dragTrash(event);
- return;
- }
- }
- var hierarquia_bottom_up = null; // Agora é descobrir qual o escopo para adicionar o comando:
- // Se o elemento clicado possuir o atributo "fun", então, é direto na div dos comandos:
- if (typeof el.data('fun') !== 'undefined') {
- // Se a lista de comandos estiver vazia, então é o primeiro.
- // Portanto, ele deve soltar o elemento obrigatoriamente no objeto vazio
- if (el.data('fun').commands == null || el.data('fun').commands.length == 0) {
- // pode adicionar
- el.data('fun').commands = [];
- var new_cmd = genericCreateCommand(command_type);
- (0,_services_userLog__WEBPACK_IMPORTED_MODULE_15__.registerUserEvent)(function_obj.name, _services_userLog__WEBPACK_IMPORTED_MODULE_15__.ActionTypes.INSERT_COMMAND, command_type, '/', 0);
- el.data('fun').commands.push(new_cmd);
- renderCommand(new_cmd, $(function_container).find('.commands_list_div'), 3, function_obj);
- } else {
- // Entra nesse else, caso já existam outros comandos no bloco:
- findNearbyCommandToAddInFunctionScope(el, event, $(function_container).find('.commands_list_div'), function_obj, command_type);
- }
- } else {
- // descobrir em qual comando ele soltou:
- var hier_find = el.parentsUntil(".commands_list_div");
- hierarquia_bottom_up = [];
- if (typeof el.data('command') !== 'undefined') {
- hierarquia_bottom_up.push(el.data('command'));
- }
- for (var i = 0; i < hier_find.length; i++) {
- if (typeof $(hier_find[i]).data('command') !== 'undefined') {
- hierarquia_bottom_up.push($(hier_find[i]).data('command'));
- }
- } // Se for do tipo break, verificar se está no contexto correto:
- // Caso não esteja no contexto, apenas retorna sem dar continuidade:
- var is_correct_context = false;
- if (command_type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["break"]) {
- for (var i = 0; i < hierarquia_bottom_up.length; i++) {
- 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"]) {
- is_correct_context = true;
- break;
- }
- }
- if (!is_correct_context) {
- console.error("Context not allowed to insert BREAK COMMAND!");
- return;
- }
- } // se a hierarquia possuir apenas um elemento, então está na raiz dos comandos:
- if (hierarquia_bottom_up.length == 1) {
- var sub_elemento = false;
- for (var i = 0; i < hier_find.length; i++) {
- if (typeof $(hier_find[i]).data('command') !== 'undefined') {
- findBeforeOrAfterCommandToAdd(hier_find[i], event, function_obj, command_type);
- sub_elemento = true;
- break;
- }
- }
- if (!sub_elemento) {
- findBeforeOrAfterCommandToAdd(el[0], event, function_obj, command_type);
- }
- } else {
- // caso exista mais de um elemento na hierarquia:
- if (typeof $(el).data('command') !== 'undefined') {
- insertCommandInBlockHierar(el[0], event, function_obj, command_type, hier_find, hierarquia_bottom_up);
- } else {
- var sub_elemento = false;
- for (var i = 0; i < hier_find.length; i++) {
- if (typeof $(hier_find[i]).data('command') !== 'undefined') {
- insertCommandInBlockHierar(hier_find[i], event, function_obj, command_type, hier_find, hierarquia_bottom_up);
- sub_elemento = true;
- break;
- }
- }
- }
- }
- } // has_element_created_draged = false;
- // which_element_is_draged = null;
- if (hierarquia_bottom_up) {
- var i = hierarquia_bottom_up.length - 1;
- var starter_index = window.program_obj.functions[window.program_obj.functions.indexOf(function_obj)].commands.indexOf(hierarquia_bottom_up[i]);
- var all_str_path = starter_index + '-' + findPathRecursive(starter_index, hierarquia_bottom_up, function_obj);
- (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);
- }
- renderAlgorithm();
- }
- function insertCommandInBlockHierar(el, event, function_obj, command_type, hier_dom, hier_obj) {
- var el_jq = $(el);
- var command_parent = el_jq.data('command');
- 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"]) {
- 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) {
- // Se não tiver outro comando ainda no bloco, só adiciona:
- if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
- command_parent.commands_block = [];
- var recentComand = genericCreateCommand(command_type);
- command_parent.commands_block.push(recentComand);
- (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);
- renderCommand(recentComand, el_jq.find('.block_commands'), 3, function_obj);
- } else {
- // Se já tem algum comando no bloco:
- findNearbyCommandToAddInBlockScope(el, event, el, function_obj, command_type, command_parent);
- }
- } else {
- // QUANDO FOR BLOCO DO TIPO IF OU SWITCH/CASE:
- addCommandToSwitchCase(event, function_obj, command_type);
- }
- } else {
- // entra neste bloco, se soltou o comando sobre outro comando dentro de um subbloco:
- findBeforeOrAfterCommandToAddInsertBlock(el, event, function_obj, command_type);
- }
- }
- function findNearbyCommandToAddInBlockScope(el, event, node_list_commands, function_obj, command_type, command_parent) {
- var all_sub = $(node_list_commands).find('div.command_container');
- var menor_distancia = 999999999;
- var elemento_menor_distancia = null;
- var antes = true;
- var t_bot;
- var t_top; // Descobrindo o elemento mais próximo:
- for (var i = 0; i < all_sub.length; i++) {
- t_top = all_sub[i].getBoundingClientRect().top;
- t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
- if (t_top - event.clientY < menor_distancia) {
- menor_distancia = event.clientY - t_top;
- elemento_menor_distancia = all_sub[i];
- }
- }
- 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:
- if (borda_inferior - event.clientY < menor_distancia) {
- var recentComand = genericCreateCommand(command_type);
- command_parent.commands_block.push(recentComand); //
- renderCommand(recentComand, node_list_commands, 3, function_obj);
- } else {
- var recentComand = genericCreateCommand(command_type);
- var index = command_parent.commands_block.indexOf($(elemento_menor_distancia).data('command'));
- if (index > -1) {
- command_parent.commands_block.splice(index, 0, recentComand);
- }
- renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
- }
- }
- function findBeforeOrAfterCommandToAddInsertBlock(el, event, function_obj, command_type) {
- var el_jq = $(el);
- var command_parent = $(el.parentNode.parentNode).data('command');
- var command_target = el_jq.data('command');
- var temp_parent = $(el.parentNode.parentNode);
- var is_in_else = false;
- if (!command_parent) {
- command_parent = el_jq.data('command');
- temp_parent = el_jq;
- var hier = el_jq.parentsUntil(".command_container");
- for (var i = 0; i < hier.length; i++) {
- var temp = $(hier[i]);
- if (typeof temp.data('else') != 'undefined') {
- is_in_else = true;
- }
- if (typeof temp.data('command') != 'undefined') {
- command_parent = temp.data('command');
- temp_parent = temp;
- }
- }
- }
- var hier = el_jq.parentsUntil(".command_container");
- for (var i = 0; i < hier.length; i++) {
- var temp = $(hier[i]);
- if (typeof temp.data('else') != 'undefined') {
- is_in_else = true;
- }
- }
- if (command_parent == command_target) {
- var hier = el_jq.parentsUntil(".command_container");
- for (var i = 0; i < hier.length; i++) {
- var temp = $(hier[i]);
- if (typeof temp.data('else') !== 'undefined') {
- is_in_else = true;
- break;
- }
- }
- }
- 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"]) {
- var hier = temp_parent.parentsUntil(".all_cases_div");
- for (var i = 0; i < hier.length; i++) {
- var temp = $(hier[i]);
- if (typeof temp.data('switchcase') !== 'undefined') {
- command_parent = temp.data('switchcase');
- is_in_else = false;
- break;
- }
- }
- }
- var menor_distancia = 999999999;
- var antes = true;
- var t_bot;
- var t_top;
- t_top = el.getBoundingClientRect().top;
- t_bot = el.getBoundingClientRect().top + el.getBoundingClientRect().height;
- var d_top = event.clientY - t_top; // distancia topo
- var d_bot = t_bot - event.clientY; // distancia baixo
- // Está mais próximo da borda de baixo, ou seja.. inserir por último:
- if (d_top < d_bot) {
- var recentComand = genericCreateCommand(command_type);
- if (is_in_else) {
- if (command_parent == command_target) {
- if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
- command_parent.commands_else = [];
- var recentComand = genericCreateCommand(command_type);
- command_parent.commands_else.push(recentComand);
- renderCommand(recentComand, el_jq, 3, function_obj);
- } else {
- // Se já tem algum comando no bloco:
- findInBlockCorrectPlace(el_jq, event, function_obj, command_type, true);
- }
- return;
- }
- var index = command_parent.commands_else.indexOf(command_target);
- if (index > -1) {
- command_parent.commands_else.splice(index, 0, recentComand);
- }
- renderCommand(recentComand, el, 1, function_obj);
- } else {
- if (command_parent == command_target) {
- if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
- command_parent.commands_block = [];
- var recentComand = genericCreateCommand(command_type);
- command_parent.commands_block.push(recentComand);
- renderCommand(recentComand, el_jq, 3, function_obj);
- } else {
- findInBlockCorrectPlace(el_jq, event, function_obj, command_type);
- }
- return;
- }
- var index = command_parent.commands_block.indexOf(command_target);
- if (index > -1) {
- command_parent.commands_block.splice(index, 0, recentComand);
- }
- renderCommand(recentComand, el, 1, function_obj);
- }
- } else {
- var recentComand = genericCreateCommand(command_type);
- if (is_in_else) {
- if (command_parent == command_target) {
- if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
- command_parent.commands_else = [];
- var recentComand = genericCreateCommand(command_type);
- command_parent.commands_else.push(recentComand);
- renderCommand(recentComand, el_jq, 3, function_obj);
- } else {
- // Se já tem algum comando no bloco:
- findInBlockCorrectPlace(el_jq, event, function_obj, command_type, true);
- }
- return;
- }
- var index = command_parent.commands_else.indexOf(command_target);
- if (index > -1) {
- command_parent.commands_else.splice(index + 1, 0, recentComand);
- }
- renderCommand(recentComand, el, 2, function_obj);
- } else {
- if (command_parent == command_target) {
- if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
- command_parent.commands_block = [];
- var recentComand = genericCreateCommand(command_type);
- command_parent.commands_block.push(recentComand);
- renderCommand(recentComand, el_jq, 3, function_obj);
- } else {
- findInBlockCorrectPlace(el_jq, event, function_obj, command_type);
- }
- return;
- }
- var index = command_parent.commands_block.indexOf(command_target);
- if (index > -1) {
- command_parent.commands_block.splice(index + 1, 0, recentComand);
- }
- renderCommand(recentComand, el, 2, function_obj);
- }
- }
- }
- function insertCommandInBlock(el, event, function_obj, command_type) {
- var el_jq = $(el);
- var command_parent = el_jq.data('command');
- 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) {
- // Se não tiver outro comando ainda no bloco, só adiciona:
- if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
- command_parent.commands_block = [];
- var recentComand = genericCreateCommand(command_type);
- command_parent.commands_block.push(recentComand);
- renderCommand(recentComand, el_jq.find('.block_commands'), 3, function_obj);
- } else {
- // Se já tem algum comando no bloco:
- findInBlockCorrectPlace(el, event, function_obj, command_type);
- }
- } else if (el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.iftrue) {
- // no if ou no else?
- var correct_div = $(document.elementFromPoint(event.pageX, event.pageY));
- var is_in_if = true;
- if (correct_div.data('if')) {
- is_in_if = true;
- } else if (correct_div.data('else')) {
- is_in_if = false;
- } else {
- var hier = correct_div.parentsUntil(".command_container");
- for (var i = 0; i < hier.length; i++) {
- var temp = $(hier[i]);
- if (typeof temp.data('if') !== 'undefined') {
- is_in_if = true;
- break;
- }
- if (typeof temp.data('else') !== 'undefined') {
- is_in_if = false;
- break;
- }
- }
- }
- if (is_in_if) {
- if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
- command_parent.commands_block = [];
- var recentComand = genericCreateCommand(command_type);
- command_parent.commands_block.push(recentComand);
- renderCommand(recentComand, el_jq.find('.commands_if'), 3, function_obj);
- } else {
- // Se já tem algum comando no bloco:
- findInBlockCorrectPlace(el_jq.find('.commands_if'), event, function_obj, command_type);
- }
- } else {
- if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
- command_parent.commands_else = [];
- var recentComand = genericCreateCommand(command_type);
- command_parent.commands_else.push(recentComand);
- renderCommand(recentComand, el_jq.find('.commands_else'), 3, function_obj);
- } else {
- // Se já tem algum comando no bloco:
- findInBlockCorrectPlace(el_jq.find('.commands_else'), event, function_obj, command_type, true);
- }
- }
- } else {
- // é do tipo switch
- addCommandToSwitchCase(event, function_obj, command_type);
- }
- }
- function addCommandToSwitchCase(event, function_obj, command_type) {
- var el = $(document.elementFromPoint(event.clientX, event.clientY));
- var which_case = el.data('switchcase');
- var case_div = el;
- if (!which_case) {
- var hier_find = el.parentsUntil(".all_cases_div");
- for (var i = 0; i < hier_find.length; i++) {
- if (typeof $(hier_find[i]).data('switchcase') !== 'undefined') {
- which_case = $(hier_find[i]).data('switchcase');
- case_div = $(hier_find[i]);
- break;
- }
- }
- }
- if (which_case.commands_block == null || which_case.commands_block.length < 1) {
- which_case.commands_block = [];
- var recentComand = genericCreateCommand(command_type);
- which_case.commands_block.push(recentComand);
- renderCommand(recentComand, case_div.find('.case_commands_block'), 3, function_obj);
- } else {
- findInBlockCorrectPlaceInSwitchCase(which_case, case_div, event, function_obj, command_type);
- }
- }
- function findInBlockCorrectPlaceInSwitchCase(which_case, case_div, event, function_obj, command_type) {
- var all_sub = case_div.find('div.command_container');
- var menor_distancia = 999999999;
- var elemento_menor_distancia = null;
- var antes = true;
- var t_bot;
- var t_top; // Descobrindo o elemento mais próximo:
- for (var i = 0; i < all_sub.length; i++) {
- t_top = all_sub[i].getBoundingClientRect().top;
- t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
- if (t_top - event.clientY < menor_distancia) {
- menor_distancia = event.clientY - t_top;
- elemento_menor_distancia = all_sub[i];
- }
- }
- 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:
- if (borda_inferior - event.clientY < menor_distancia) {
- var recentComand = genericCreateCommand(command_type);
- which_case.commands_block.push(recentComand);
- renderCommand(recentComand, $(case_div.find('.case_commands_block')[0]), 3, function_obj);
- } else {
- var recentComand = genericCreateCommand(command_type);
- var index = which_case.commands_block.indexOf($(elemento_menor_distancia).data('command'));
- if (index > -1) {
- which_case.commands_block.splice(index, 0, recentComand);
- renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
- }
- }
- }
- function findInBlockCorrectPlace(el, event, function_obj, command_type) {
- var is_in_else = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
- var el_jq = $(el);
- var all_sub = el_jq.find('div.command_container');
- var menor_distancia = 999999999;
- var elemento_menor_distancia = null;
- var antes = true;
- var t_bot;
- var t_top; // Descobrindo o elemento mais próximo:
- for (var i = 0; i < all_sub.length; i++) {
- t_top = all_sub[i].getBoundingClientRect().top;
- t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
- if (t_top - event.clientY < menor_distancia) {
- menor_distancia = event.clientY - t_top;
- elemento_menor_distancia = all_sub[i];
- }
- }
- 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:
- if (borda_inferior - event.clientY < menor_distancia) {
- var recentComand = genericCreateCommand(command_type);
- var command_parent = el_jq.data('command');
- if (is_in_else) {
- command_parent.commands_else.push(recentComand);
- renderCommand(recentComand, el_jq, 3, function_obj);
- } else {
- command_parent.commands_block.push(recentComand);
- renderCommand(recentComand, $(el_jq.find('.block_commands')[0]), 3, function_obj);
- }
- } else {
- var recentComand = genericCreateCommand(command_type);
- var command_parent = el_jq.data('command');
- if (is_in_else) {
- var index = command_parent.commands_else.indexOf($(elemento_menor_distancia).data('command'));
- if (index > -1) {
- command_parent.commands_else.splice(index, 0, recentComand);
- renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
- }
- } else {
- var index = command_parent.commands_block.indexOf($(elemento_menor_distancia).data('command'));
- if (index > -1) {
- command_parent.commands_block.splice(index, 0, recentComand);
- renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
- }
- }
- }
- }
- function findBeforeOrAfterCommandToAdd(el, event, function_obj, command_type) {
- switch ($(el).data('command').type) {
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.iftrue:
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["switch"]:
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.repeatNtimes:
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.whiletrue:
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.dowhiletrue:
- insertCommandInBlock(el, event, function_obj, command_type);
- return;
- }
- var menor_distancia = 999999999;
- var antes = true;
- var t_bot;
- var t_top;
- t_top = el.getBoundingClientRect().top;
- t_bot = el.getBoundingClientRect().top + el.getBoundingClientRect().height;
- var d_top = event.clientY - t_top; // distancia topo
- var d_bot = t_bot - event.clientY; // distancia baixo
- // Está mais próximo da borda de baixo, ou seja.. inserir por último:
- if (d_top < d_bot) {
- var recentComand = genericCreateCommand(command_type);
- var index = function_obj.commands.indexOf($(el).data('command'));
- if (index > -1) {
- function_obj.commands.splice(index, 0, recentComand);
- }
- renderCommand(recentComand, el, 1, function_obj);
- (0,_services_userLog__WEBPACK_IMPORTED_MODULE_15__.registerUserEvent)(function_obj.name, _services_userLog__WEBPACK_IMPORTED_MODULE_15__.ActionTypes.INSERT_COMMAND, command_type, '/', index);
- } else {
- var recentComand = genericCreateCommand(command_type);
- var index = function_obj.commands.indexOf($(el).data('command'));
- if (index > -1) {
- function_obj.commands.splice(index + 1, 0, recentComand);
- }
- renderCommand(recentComand, el, 2, function_obj);
- (0,_services_userLog__WEBPACK_IMPORTED_MODULE_15__.registerUserEvent)(function_obj.name, _services_userLog__WEBPACK_IMPORTED_MODULE_15__.ActionTypes.INSERT_COMMAND, command_type, '/', index);
- }
- }
- function findNearbyCommandToAddInFunctionScope(el, event, node_list_commands, function_obj, command_type) {
- var all_sub = $(node_list_commands).find('div.command_container');
- var menor_distancia = 999999999;
- var elemento_menor_distancia = null;
- var antes = true;
- var t_bot;
- var t_top; // Descobrindo o elemento mais próximo:
- for (var i = 0; i < all_sub.length; i++) {
- t_top = all_sub[i].getBoundingClientRect().top;
- t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
- if (t_top - event.clientY < menor_distancia) {
- menor_distancia = event.clientY - t_top;
- elemento_menor_distancia = all_sub[i];
- }
- }
- 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:
- if (borda_inferior - event.clientY < menor_distancia) {
- var recentComand = genericCreateCommand(command_type);
- function_obj.commands.push(recentComand); //
- renderCommand(recentComand, node_list_commands, 3, function_obj);
- (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);
- } else {
- var recentComand = genericCreateCommand(command_type);
- var index = function_obj.commands.indexOf($(elemento_menor_distancia).data('command'));
- if (index > -1) {
- function_obj.commands.splice(index, 0, recentComand);
- }
- renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
- (0,_services_userLog__WEBPACK_IMPORTED_MODULE_15__.registerUserEvent)(function_obj.name, _services_userLog__WEBPACK_IMPORTED_MODULE_15__.ActionTypes.INSERT_COMMAND, command_type, '/', index);
- }
- }
- /***/ }),
- /***/ "./js/visualUI/commands/attribution.js":
- /*!*********************************************!*\
- !*** ./js/visualUI/commands/attribution.js ***!
- \*********************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "createFloatingCommand": () => (/* binding */ createFloatingCommand),
- /* harmony export */ "renderCommand": () => (/* binding */ renderCommand),
- /* harmony export */ "manageExpressionElements": () => (/* binding */ manageExpressionElements),
- /* harmony export */ "renderMenuOperations": () => (/* binding */ renderMenuOperations)
- /* harmony export */ });
- /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
- /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
- /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
- /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
- /* harmony import */ var _generic_expression__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./generic_expression */ "./js/visualUI/commands/generic_expression.js");
- /* harmony import */ var _code_generator__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../code_generator */ "./js/visualUI/code_generator.js");
- /* harmony import */ var _algorithm__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../algorithm */ "./js/visualUI/algorithm.js");
- function createFloatingCommand() {
- return $('<div class="ui attribution created_element"> <i class="ui icon small arrow left"></i> <span> x <— 1 + 1 </span></div>');
- }
- function renderCommand(command, function_obj) {
- 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>');
- el.data('command', command);
- _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, command.variable, el.find('.var_attributed'), function_obj);
- if (!command.expression || command.expression.length < 1) {
- 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);
- command.expression.push(exp);
- }
- addHandlers(command, function_obj, el);
- _generic_expression__WEBPACK_IMPORTED_MODULE_4__.renderExpression(command, function_obj, el.find('.expression_elements'), command.expression);
- if (command.lockexpression) {
- if (command.expression) {
- try {
- var text = _code_generator__WEBPACK_IMPORTED_MODULE_5__.elementExpressionCode(command.expression);
- if (text) {
- $(el.find('.expression_elements')[0]).toggle();
- $(el.find('.textual_expression')[0]).text(text);
- $(el.find('.textual_expression')[0]).toggle();
- $(el.find('.button_alternate_expression')[0]).toggleClass('unlock').toggleClass('lock');
- }
- } catch (e) {
- command.lockexpression = false;
- }
- }
- }
- el.find('.unlock').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_lock_expression"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- el.find('.lock').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_unlock_expression"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- el.find('.button_write_expression').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_edit_expression"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- return el;
- }
- function manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, selectedItem, expression_element) {
- var index_to_move = expression_element.itens.indexOf(ref_object);
- switch (selectedItem.data('exp')) {
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.exp_op_exp:
- 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)]);
- expression_element.itens[index_to_move] = exp;
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.op_exp:
- 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]]);
- expression_element.itens[index_to_move] = exp;
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.par_exp_par:
- 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]]);
- expression_element.itens[index_to_move] = exp;
- break;
- }
- renderExpressionElements(command, function_obj, dom_object);
- }
- function renderExpressionElements(command, function_obj, el) {
- var expression_div = el.find('.expression_elements');
- var command_container;
- if (el.hasClass("command_container") == false) {
- var hier = el.parentsUntil(".command_container");
- for (var i = 0; i < hier.length; i++) {
- if ($(hier[i]).hasClass("command_container")) {
- command_container = $(hier[i]);
- break;
- }
- if ($(hier[i]).hasClass("expression_elements")) {
- expression_div = $(hier[i]);
- break;
- }
- }
- }
- if (command_container) {
- expression_div = command_container.find('.expression_elements');
- }
- expression_div.text('');
- for (var i = 0; i < command.expression.length; i++) {
- var temp = $('<div class="expression_element"></div>');
- temp.data('ref_element', command.expression[i]);
- temp.data('ref_index', i);
- expression_div.append(temp);
- renderElement(command, function_obj, temp, command.expression[i]);
- }
- }
- function renderOperator(command, function_obj, temp_op, expression_element, index_op) {
- var context_menu = '<div class="ui dropdown"><div class="text">';
- switch (expression_element.itens[index_op]) {
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.plus:
- context_menu += '+';
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.minus:
- context_menu += '-';
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.multiplication:
- context_menu += '*';
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.division:
- context_menu += '/';
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.module:
- context_menu += '%';
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.none:
- context_menu += '...';
- break;
- }
- context_menu += '</div><div class="menu">';
- context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.plus + '">+</div>';
- context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.minus + '">-</div>';
- context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.multiplication + '">*</div>';
- context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.division + '">/</div>';
- context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.module + '">%</div>';
- context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.none + '" data-text="...">Nenhum</div>';
- context_menu += '</div></div>';
- context_menu = $(context_menu);
- temp_op.append(context_menu);
- context_menu.dropdown({
- onChange: function onChange(value, text, $selectedItem) {
- expression_element.itens[index_op] = value;
- }
- });
- }
- function renderMenuAddExpression(command, function_obj, el, dom_append_menu, expression_append_new_expression) {
- if (el.hasClass("command_container") == false) {
- var hier = el.parentsUntil(".commands_list_div");
- for (var i = 0; i < hier.length; i++) {
- if ($(hier[i]).hasClass("command_container")) {
- el = $(hier[i]);
- break;
- }
- }
- }
- if (dom_append_menu.hasClass("expression_elements") == false) {
- var hier = el.parentsUntil(".commands_list_div");
- for (var i = 0; i < hier.length; i++) {
- if ($(hier[i]).hasClass("expression_elements")) {
- dom_append_menu = $(hier[i]);
- break;
- }
- }
- }
- var context_menu = '<div class="ui dropdown"><div class="text"></div><i class="ui icon arrow alternate circle right outline"></i><div class="menu">';
- context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
- context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
- context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
- context_menu += '</div></div>';
- context_menu = $(context_menu);
- dom_append_menu.append(context_menu);
- context_menu.dropdown({
- onChange: function onChange(value, text, $selectedItem) {
- switch (value) {
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.exp_op_exp:
- 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)]);
- expression_append_new_expression.push(exp);
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.op_exp:
- 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)]);
- expression_append_new_expression.push(exp);
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.par_exp_par:
- 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)]);
- expression_append_new_expression.push(exp);
- break;
- }
- renderExpressionElements(command, function_obj, el);
- }
- });
- }
- function renderElement(command, function_obj, el, expression_element) {
- switch (expression_element.type_exp) {
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.exp_op_exp:
- var temp_op = $('<div class="component_element"></div>');
- var temp_exp_1 = $('<div class="component_element"></div>');
- var temp_exp_2 = $('<div class="component_element"></div>');
- el.append(temp_exp_1);
- el.append(temp_op);
- el.append(temp_exp_2);
- if (expression_element.itens[0].type) {
- _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, expression_element.itens[0], temp_exp_1, function_obj, 2, expression_element);
- } else {
- renderElement(command, function_obj, temp_exp_1, expression_element.itens[0]);
- }
- renderOperator(command, function_obj, temp_op, expression_element, 1);
- if (expression_element.itens[2].type) {
- _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, expression_element.itens[2], temp_exp_2, function_obj, 2, expression_element);
- } else {
- renderElement(command, function_obj, temp_exp_2, expression_element.itens[2]);
- }
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.op_exp:
- var temp_op = $('<div class="component_element"></div>');
- var temp_exp = $('<div class="component_element"></div>');
- el.append(temp_op);
- el.append(temp_exp);
- renderOperator(command, function_obj, temp_op, expression_element, 0);
- if (expression_element.itens[1].type) {
- _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, expression_element.itens[1], temp_exp, function_obj, 2, expression_element);
- } else {
- renderElement(command, function_obj, temp_exp, expression_element.itens[1]);
- }
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.par_exp_par:
- var temp_par_1 = $('<div class="component_element"> ( </div>');
- var temp_exp = $('<div class="component_element"></div>');
- var temp_par_2 = $('<div class="component_element"> ) </div>');
- el.append(temp_par_1);
- el.append(temp_exp);
- for (var j = 0; j < expression_element.itens.length; j++) {
- if (expression_element.itens[j].type) {
- _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, expression_element.itens[j], temp_exp, function_obj, 2, expression_element);
- } else {
- renderElement(command, function_obj, temp_exp, expression_element.itens[j]);
- }
- } //renderMenuAddExpression(command, function_obj, el, el, expression_element.itens);
- el.append(temp_par_2);
- break;
- }
- }
- function renderExpression(command, function_obj, el) {
- var expression_div = el.find('.expression_elements');
- expression_div.text('');
- var menu_add_item = $('<div class="menu_add_item"></div>');
- menu_add_item.data('index_add', 0);
- expression_div.append(menu_add_item);
- for (var i = 0; i < command.expression.length; i++) {
- if (command.expression[i].type) {
- var temp = $('<div class="expression_element"></div>');
- temp.data('ref_element', command.expression[i]);
- temp.data('ref_index', i);
- expression_div.append(temp);
- _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, command.expression[i], temp, function_obj);
- } else if (command.expression[i] == "(" || command.expression[i] == ")") {
- var temp = $('<div class="expression_element">' + command.expression[i] + '</div>');
- temp.data('ref_element', command.expression[i]);
- temp.data('ref_index', i);
- expression_div.append(temp);
- } else {
- var temp = '<div class="expression_element">';
- switch (command.expression[i]) {
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.plus:
- temp += '+';
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.minus:
- temp += '-';
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.multiplication:
- temp += '*';
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.division:
- temp += '/';
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.module:
- temp += '%';
- break;
- }
- temp += '</div>';
- temp = $(temp);
- temp.data('ref_element', command.expression[i]);
- temp.data('ref_index', i);
- expression_div.append(temp);
- }
- var menu_add_item_seq = $('<div class="menu_add_item"></div>');
- var index_temp = i + 1;
- menu_add_item_seq.data('index_add', index_temp);
- expression_div.append(menu_add_item_seq);
- }
- addMenuItens(command, function_obj, el);
- }
- function addMenuItens(command, function_obj, expression_div) {
- var divs_expression = expression_div.find('.menu_add_item');
- for (var i = 0; i < divs_expression.length; i++) {
- var temp = $(divs_expression[i]).data('index_add');
- var context_menu = '<div class="ui dropdown context_menu_clear"><i class="ui icon plus square outline"></i><div class="menu">';
- context_menu += '<div class="item" data-option="value" data-index="' + temp + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI('text_value') + '</div>';
- context_menu += '<div class="item" data-option="operator" data-index="' + temp + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI('text_operator') + '</div>';
- context_menu += '<div class="item" data-option="parentheses" data-index="' + temp + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI('text_parentheses') + '</div>';
- context_menu += '</div></div>';
- context_menu = $(context_menu);
- $(divs_expression[i]).append(context_menu);
- context_menu.dropdown({
- on: 'hover',
- onChange: function onChange(value, text, $selectedItem) {
- switch ($selectedItem.data('option')) {
- case "value":
- 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));
- renderExpression(command, function_obj, expression_div);
- break;
- case "operator":
- command.expression.splice($selectedItem.data('index'), 0, _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.plus);
- renderExpression(command, function_obj, expression_div);
- break;
- case "parentheses":
- command.expression.splice($selectedItem.data('index'), 0, "(");
- 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));
- command.expression.splice($selectedItem.data('index') + 2, 0, ")");
- renderExpression(command, function_obj, expression_div);
- break;
- }
- }
- });
- }
- }
- function addHandlers(command, function_obj, attribution_dom) {
- attribution_dom.find('.button_write_expression').on('click', function () {
- window.expressionEdition = true;
- window.inputExpression = null;
- var afterWhichElement;
- var lockButton = $(attribution_dom.find('.button_alternate_expression')[0]);
- var editButton = $(this);
- afterWhichElement = attribution_dom.find('.expression_elements');
- if (command.lockexpression) {
- afterWhichElement = attribution_dom.find('.textual_expression');
- }
- var text = "";
- if (command.expression) {
- if (command.expression.length == 1 && command.expression[0].content == null && !command.expression[0].function_called) {
- text = "";
- } else {
- try {
- text = _code_generator__WEBPACK_IMPORTED_MODULE_5__.elementExpressionCode(command.expression);
- } catch (ex) {
- text = "";
- }
- }
- }
- var ok_button = $('<i class="ui icon check circle expression-edit-confirm"></i>');
- var cancel_button = $('<i class="ui icon undo expression-edit-cancel"></i>');
- var input = $('<input type="text" spellcheck="false" autocomplete="off" class="input-expression-field" >');
- input.val(text);
- input.focusout(function (evt) {
- console.log('focosout event!');
- ok_button.click();
- evt.preventDefault();
- return true;
- });
- input.keyup(function (evt) {
- if (evt.keyCode == 27) {
- // esc
- cancel_button.click();
- }
- if (evt.keyCode == 13) {
- // enter
- ok_button.click();
- }
- });
- ok_button.click(function () {
- var parsed = null;
- parsed = _generic_expression__WEBPACK_IMPORTED_MODULE_4__.expressionParserToVisual(input.val(), function_obj, input);
- if (parsed) {
- window.expressionEdition = false;
- command.expression = parsed;
- (0,_algorithm__WEBPACK_IMPORTED_MODULE_6__.renderAlgorithm)();
- }
- });
- cancel_button.mousedown(function (evt) {
- var parsed = _generic_expression__WEBPACK_IMPORTED_MODULE_4__.expressionParserToVisual(text, function_obj, input);
- if (parsed) {
- window.expressionEdition = false;
- command.expression = parsed;
- (0,_algorithm__WEBPACK_IMPORTED_MODULE_6__.renderAlgorithm)();
- }
- });
- input.insertAfter(afterWhichElement);
- input.focus();
- cancel_button.insertAfter(input);
- ok_button.insertAfter(input);
- var len = text.length;
- input[0].setSelectionRange(len, len);
- afterWhichElement.css('display', 'none');
- lockButton.css('display', 'none');
- editButton.css('display', 'none');
- ok_button.popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_edit_expression_confirm"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- cancel_button.popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_edit_expression_cancel"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- });
- $(attribution_dom.find('.textual_expression')[0]).toggle();
- attribution_dom.find('.button_alternate_expression').on('click', function () {
- if (command.expression) {
- var text = _code_generator__WEBPACK_IMPORTED_MODULE_5__.elementExpressionCode(command.expression);
- if (text) {
- $(attribution_dom.find('.expression_elements')[0]).toggle();
- $(attribution_dom.find('.textual_expression')[0]).text(text);
- $(attribution_dom.find('.textual_expression')[0]).toggle();
- $(this).toggleClass('unlock').toggleClass('lock');
- command.lockexpression = !command.lockexpression;
- }
- if (command.lockexpression) {
- attribution_dom.find('.lock').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_unlock_expression"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- } else {
- attribution_dom.find('.unlock').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_lock_expression"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- }
- }
- });
- attribution_dom.find('.button_remove_command').on('click', function () {
- if (_commands__WEBPACK_IMPORTED_MODULE_3__.removeCommand(command, function_obj, attribution_dom)) {
- attribution_dom.fadeOut(400, function () {
- attribution_dom.remove();
- });
- }
- });
- attribution_dom.find('.button_refresh_attribution').on('click', function () {
- renderExpressionElements(command, function_obj, attribution_dom);
- });
- }
- function renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected) {
- /*console.log("recebido o seguinte DOM: ");
- console.log(dom_object);
- if (dom_object.hasClass('var_attributed')) {
- return;
- } else {
- var hier = dom_object.parentsUntil(".command_container");
- for (var i = 0; i < hier.length; i++) {
- if ($(hier[i]).hasClass('var_attributed') || $(hier[i]).hasClass('parameters_function_called')) {
- return;
- }
- }
-
-
- }
- dom_object.find('.context_menu_clear').remove();
-
- var menu_operations = '<div class="ui dropdown menu_operations"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
- for (var tm in Models.ARITHMETIC_TYPES) {
- menu_operations += '<div class="item" data-option="'+tm+'">'+LocalizedStrings.getUI('btn_arithmetic_' + tm)+'</div>';
- }
- menu_operations += '<div class="item" data-option="clear">'+LocalizedStrings.getUI('btn_clear')+'</div>';
-
- menu_operations += '</div></div>';
- menu_operations = $(menu_operations);
- dom_object.append(menu_operations);
- menu_operations.dropdown({
- onChange: function(value, text, $selectedItem) {
- switch ($($selectedItem).data('option')) {
- case "clear":
- $(dom_object).text('');
- VariableValueMenu.renderMenu(command, ref_object, dom_object, function_obj);
- break;
- default:
- createExpressionAround(command, ref_object, dom_object, function_obj);
- menu_operations.find('.text').text('');
- }
- }
- });*/
- }
- function createExpressionAround(command, ref_object, dom_object, function_obj) {
- $('<span> ( </span>').insertBefore(dom_object);
- $('<span> ) </span>').insertAfter(dom_object);
- _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);
- }
- /***/ }),
- /***/ "./js/visualUI/commands/break.js":
- /*!***************************************!*\
- !*** ./js/visualUI/commands/break.js ***!
- \***************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "createFloatingCommand": () => (/* binding */ createFloatingCommand),
- /* harmony export */ "renderCommand": () => (/* binding */ renderCommand)
- /* harmony export */ });
- /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
- /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
- function createFloatingCommand() {
- 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>');
- }
- function renderCommand(command, function_obj) {
- 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>');
- el.data('command', command);
- addHandlers(command, function_obj, el);
- return el;
- }
- function addHandlers(command, function_obj, break_dom) {
- break_dom.find('.button_remove_command').on('click', function () {
- if (_commands__WEBPACK_IMPORTED_MODULE_1__.removeCommand(command, function_obj, break_dom)) {
- break_dom.fadeOut(400, function () {
- break_dom.remove();
- });
- }
- });
- }
- /***/ }),
- /***/ "./js/visualUI/commands/comment.js":
- /*!*****************************************!*\
- !*** ./js/visualUI/commands/comment.js ***!
- \*****************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "createFloatingCommand": () => (/* binding */ createFloatingCommand),
- /* harmony export */ "renderCommand": () => (/* binding */ renderCommand)
- /* harmony export */ });
- /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
- /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
- /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
- function createFloatingCommand() {
- 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>');
- }
- function renderCommand(command, function_obj) {
- 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>');
- el.data('command', command);
- addHandlers(command, function_obj, el);
- renderTextComment(command, function_obj, el);
- return el;
- }
- function renderTextComment(command, function_obj, el) {
- _variable_value_menu__WEBPACK_IMPORTED_MODULE_1__.renderMenu(command, command.comment_text, el.find('.var_value_menu_div'), function_obj, 20);
- }
- function addHandlers(command, function_obj, comment_dom) {
- comment_dom.find('.button_remove_command').on('click', function () {
- if (_commands__WEBPACK_IMPORTED_MODULE_2__.removeCommand(command, function_obj, comment_dom)) {
- comment_dom.fadeOut(400, function () {
- comment_dom.remove();
- });
- }
- });
- }
- /***/ }),
- /***/ "./js/visualUI/commands/conditional_expression.js":
- /*!********************************************************!*\
- !*** ./js/visualUI/commands/conditional_expression.js ***!
- \********************************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "renderExpression": () => (/* binding */ renderExpression)
- /* harmony export */ });
- /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
- /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
- /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
- function renderExpression(command, expression, function_obj, initial_el_to_render) {
- expression.dom_object = initial_el_to_render;
- if (expression.expression == null || expression.expression.length < 1) {
- renderStartMenu(command, expression, function_obj, initial_el_to_render);
- } else {
- var main_div = $('<div class="expression_elements"></div>');
- switch (expression.expression.type) {
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_TYPES.exp_logic:
- renderLogicExpression(command, expression, expression.expression, function_obj, main_div, initial_el_to_render);
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_TYPES.exp_arithmetic:
- renderArithmeticExpression(command, expression, expression.expression, function_obj, main_div);
- break;
- }
- initial_el_to_render.append(main_div);
- var restartMenu = $('<div class="ui restart_expression"><i class="ui icon undo"></i></div>');
- initial_el_to_render.append(restartMenu);
- restartMenu.on('click', function (e) {
- expression.expression = null;
- initial_el_to_render.empty();
- renderExpression(command, expression, function_obj, initial_el_to_render);
- });
- }
- }
- function renderArithmeticOperator(command, all_expression, expression_arithmetic, arithmetic_operator, function_obj, element_to_append) {
- var menu_operator = $('<div class="ui dropdown"><div class="text"></div><i class="dropdown icon"></i></div>');
- menu_operator.dropdown({
- values: [{
- name: '>',
- value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_COMPARISON.greater_than,
- selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_COMPARISON.greater_than
- }, {
- name: '<',
- value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_COMPARISON.less_than,
- selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_COMPARISON.less_than
- }, {
- name: '==',
- value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_COMPARISON.equals_to,
- selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_COMPARISON.equals_to
- }, {
- name: '!=',
- value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_COMPARISON.not_equals_to,
- selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_COMPARISON.not_equals_to
- }, {
- name: '>=',
- value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_COMPARISON.greater_than_or_equals_to,
- selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_COMPARISON.greater_than_or_equals_to
- }, {
- name: '<=',
- value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_COMPARISON.less_than_or_equals_to,
- selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_COMPARISON.less_than_or_equals_to
- }],
- onChange: function onChange(value, text, $selectedItem) {
- expression_arithmetic.operator = value;
- }
- });
- element_to_append.append(menu_operator);
- }
- function renderLogicOperator(command, all_expression, expression_logic, logic_operator, function_obj, element_to_append, initial_el_to_render) {
- var menu_operator = $('<div class="ui dropdown"><div class="text"></div><i class="dropdown icon"></i></div>');
- menu_operator.dropdown({
- values: [{
- name: '==',
- value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.LOGIC_COMPARISON.equals_to,
- selected: logic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.LOGIC_COMPARISON.equals_to
- }, {
- name: '!=',
- value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.LOGIC_COMPARISON.not_equals_to,
- selected: logic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.LOGIC_COMPARISON.not_equals_to
- }, {
- name: '&&',
- value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.LOGIC_COMPARISON.and,
- selected: logic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.LOGIC_COMPARISON.and
- }, {
- name: '||',
- value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.LOGIC_COMPARISON.or,
- selected: logic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.LOGIC_COMPARISON.or
- }],
- onChange: function onChange(value, text, $selectedItem) {
- if ($selectedItem) {
- expression_logic.operator = value;
- if (expression_logic.second_operand == null) {
- 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);
- initial_el_to_render.empty();
- renderExpression(command, all_expression, function_obj, initial_el_to_render);
- }
- }
- }
- });
- element_to_append.append(menu_operator);
- }
- function renderLogicExpression(command, all_expression, expression_logic, function_obj, element_to_append, initial_el_to_render) {
- var exp_el_par_1 = $(' <span class="span_command_spec"> </span> ');
- var exp_el_expr_el_1 = $('<div class="expression_element"></div>');
- var exp_el_expr_operand = $('<div class="expression_element"></div>');
- var exp_el_expr_el_2 = $('<div class="expression_element"></div>');
- var exp_el_par_2 = $(' <span class="span_command_spec"> </span> ');
- if (expression_logic.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_TYPES.exp_logic) {
- renderLogicExpression(command, all_expression, expression_logic.first_operand, function_obj, exp_el_expr_el_1);
- } else if (expression_logic.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_TYPES.exp_arithmetic) {
- renderArithmeticExpression(command, all_expression, expression_logic.first_operand, function_obj, exp_el_expr_el_1);
- } else {
- _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, expression_logic.first_operand, exp_el_expr_el_1, function_obj);
- }
- element_to_append.append(exp_el_par_1);
- element_to_append.append(exp_el_expr_el_1);
- renderLogicOperator(command, all_expression, expression_logic, expression_logic.operator, function_obj, exp_el_expr_operand, initial_el_to_render);
- element_to_append.append(exp_el_expr_operand);
- if (expression_logic.second_operand) {
- if (expression_logic.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_TYPES.exp_logic) {
- renderLogicExpression(command, all_expression, expression_logic.second_operand, function_obj, exp_el_expr_el_2);
- } else if (expression_logic.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_TYPES.exp_arithmetic) {
- renderArithmeticExpression(command, all_expression, expression_logic.second_operand, function_obj, exp_el_expr_el_2);
- } else {
- _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, expression_logic.second_operand, exp_el_expr_el_2, function_obj);
- }
- element_to_append.append(exp_el_expr_el_2);
- }
- element_to_append.append(exp_el_par_2);
- }
- function renderArithmeticExpression(command, all_expression, expression_arithmetic, function_obj, element_to_append) {
- var exp_el_par_1 = $(' <span class="span_command_spec"> </span> ');
- var exp_el_expr_el_1 = $('<div class="expression_element"></div>');
- var exp_el_expr_operand = $('<div class="expression_element"></div>');
- var exp_el_expr_el_2 = $('<div class="expression_element"></div>');
- var exp_el_par_2 = $(' <span class="span_command_spec"> </span> ');
- if (expression_arithmetic.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_TYPES.exp_logic) {
- renderLogicExpression(command, all_expression, expression_arithmetic.first_operand, function_obj, exp_el_expr_el_1);
- } else if (expression_arithmetic.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_TYPES.exp_arithmetic) {
- renderArithmeticExpression(command, all_expression, expression_arithmetic.first_operand, function_obj, exp_el_expr_el_1);
- } else {
- _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, expression_arithmetic.first_operand, exp_el_expr_el_1, function_obj);
- }
- if (expression_arithmetic.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_TYPES.exp_logic) {
- renderLogicExpression(command, all_expression, expression_arithmetic.second_operand, function_obj, exp_el_expr_el_2);
- } else if (expression_arithmetic.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_TYPES.exp_arithmetic) {
- renderArithmeticExpression(command, all_expression, expression_arithmetic.second_operand, function_obj, exp_el_expr_el_2);
- } else {
- _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, expression_arithmetic.second_operand, exp_el_expr_el_2, function_obj);
- }
- renderArithmeticOperator(command, all_expression, expression_arithmetic, expression_arithmetic.operator, function_obj, exp_el_expr_operand);
- element_to_append.append(exp_el_par_1);
- element_to_append.append(exp_el_expr_el_1);
- element_to_append.append(exp_el_expr_operand);
- element_to_append.append(exp_el_expr_el_2);
- element_to_append.append(exp_el_par_2);
- }
- function renderStartMenu(command, expression, function_obj, initial_el_to_render) {
- var start_menu = '';
- 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">';
- 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>';
- 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>';
- start_menu += '</div></div>';
- start_menu = $(start_menu);
- start_menu.dropdown({
- onChange: function onChange(value, text, $selectedItem) {
- switch ($selectedItem.data('exp')) {
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_TYPES.exp_logic:
- 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));
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_TYPES.exp_arithmetic:
- 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);
- break;
- }
- initial_el_to_render.html('');
- renderExpression(command, expression, function_obj, initial_el_to_render);
- },
- selectOnKeydown: false
- });
- initial_el_to_render.append(' <span class="span_command_spec"> </span> ');
- initial_el_to_render.append(start_menu);
- initial_el_to_render.append(' <span class="span_command_spec"> </span> ');
- }
- /***/ }),
- /***/ "./js/visualUI/commands/contextualized_menu.js":
- /*!*****************************************************!*\
- !*** ./js/visualUI/commands/contextualized_menu.js ***!
- \*****************************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "renderMenu": () => (/* binding */ renderMenu)
- /* harmony export */ });
- /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
- /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
- /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
- /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
- /* harmony import */ var _switch__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./switch */ "./js/visualUI/commands/switch.js");
- function renderMenu(command, dom_where_render, function_obj, dom_command) {
- var menu_div = '<div class="ui dropdown menu_commands pause" ><button><i class="icon code"></i></button> <div class="menu"> ';
- 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) {
- 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>';
- } else {
- 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>';
- 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>';
- }
- menu_div += '</div></div>';
- menu_div = $(menu_div);
- dom_where_render.append(menu_div);
- addHandlers(command, dom_where_render, function_obj, dom_command);
- if (command.collapsed) {
- dom_command.children('.ui.block_commands').toggle();
- }
- }
- function addHandlers(command, dom_where_render, function_obj, dom_command) {
- dom_where_render.find('.menu_commands').dropdown({
- on: 'hover'
- });
- dom_where_render.find('.menu_commands a').on('click', function (evt) {
- 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) {
- if (command.commands_block == null || command.commands_block.length == 0) {
- command.commands_block = [];
- var new_cmd = _commands__WEBPACK_IMPORTED_MODULE_2__.genericCreateCommand($(this).data('command'));
- command.commands_block.push(new_cmd);
- _commands__WEBPACK_IMPORTED_MODULE_2__.renderCommand(new_cmd, dom_command.find('.block_commands'), 3, function_obj);
- } else {
- _commands__WEBPACK_IMPORTED_MODULE_2__.createFloatingCommand(function_obj, dom_command.find('.block_commands'), $(this).data('command'), evt);
- }
- } else {
- switch ($(this).data('command')) {
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["break"]:
- _commands__WEBPACK_IMPORTED_MODULE_2__.createFloatingCommand(function_obj, dom_command.find('.block_commands'), $(this).data('command'), evt);
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.switchcase:
- addCaseToSwitch(command, dom_where_render, function_obj, dom_command);
- break;
- }
- }
- });
- }
- function addCaseToSwitch(command, dom_where_render, function_obj, dom_command) {
- if (command.cases == null) {
- command.cases = [];
- }
- 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));
- command.cases.push(sc);
- _switch__WEBPACK_IMPORTED_MODULE_4__.renderCase(sc, command, function_obj, dom_command.find('.all_cases_div'));
- }
- /***/ }),
- /***/ "./js/visualUI/commands/dowhiletrue.js":
- /*!*********************************************!*\
- !*** ./js/visualUI/commands/dowhiletrue.js ***!
- \*********************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "createFloatingCommand": () => (/* binding */ createFloatingCommand),
- /* harmony export */ "renderCommand": () => (/* binding */ renderCommand)
- /* harmony export */ });
- /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
- /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
- /* harmony import */ var _conditional_expression__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
- /* harmony import */ var _contextualized_menu__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
- /* harmony import */ var _generic_expression__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./generic_expression */ "./js/visualUI/commands/generic_expression.js");
- /* harmony import */ var _code_generator__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../code_generator */ "./js/visualUI/code_generator.js");
- function createFloatingCommand() {
- 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>');
- }
- function renderCommand(command, function_obj) {
- var ret = '';
- 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>';
- ret += '<div class="ui block_commands" data-subblock="" data-idcommand="">';
- ret += '</div>';
- 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>';
- 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> ';
- ret += '</div>';
- var el = $(ret);
- el.data('command', command);
- el.find('.block_commands').data('command', command);
- addHandlers(command, function_obj, el);
- _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'));
- if (command.expression) {
- _generic_expression__WEBPACK_IMPORTED_MODULE_4__.renderExpression(command, function_obj, el.find('.conditional_expression'), command.expression);
- }
- if (command.commands_block) {
- for (var j = 0; j < command.commands_block.length; j++) {
- _commands__WEBPACK_IMPORTED_MODULE_1__.renderCommand(command.commands_block[j], $(el.find('.block_commands')[0]), 3, function_obj);
- }
- }
- if (command.lockexpression) {
- if (command.expression) {
- try {
- var text = _code_generator__WEBPACK_IMPORTED_MODULE_5__.elementExpressionCode(command.expression);
- if (text) {
- $(el.find('.conditional_expression')[el.find('.conditional_expression').length - 1]).toggle();
- $(el.find('.textual_expression')[el.find('.textual_expression').length - 1]).text(text);
- $(el.find('.textual_expression')[el.find('.textual_expression').length - 1]).toggle();
- $(el.find('.button_alternate_expression')[el.find('.button_alternate_expression').length - 1]).toggleClass('unlock').toggleClass('lock');
- }
- } catch (e) {
- command.lockexpression = false;
- }
- }
- }
- el.find('.unlock').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_lock_expression"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- el.find('.lock').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_unlock_expression"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- el.find('.button_write_expression').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_edit_expression"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- return el;
- }
- function addHandlers(command, function_obj, dowhiletrue_dom) {
- dowhiletrue_dom.find('.button_write_expression').on('click', function () {
- window.expressionEdition = true;
- window.inputExpression = null;
- var afterWhichElement;
- var lockButton = $(dowhiletrue_dom.find('.button_write_expression')[dowhiletrue_dom.find('.button_write_expression').length - 1]);
- var editButton = $(this);
- afterWhichElement = $(dowhiletrue_dom.find('.conditional_expression')[dowhiletrue_dom.find('.conditional_expression').length - 1]);
- if (command.lockexpression) {
- afterWhichElement = $(dowhiletrue_dom.find('.textual_expression')[dowhiletrue_dom.find('.textual_expression').length - 1]);
- }
- var text = "";
- if (command.expression) {
- if (command.expression.length == 1 && command.expression[0].content == null && !command.expression[0].function_called) {
- text = "";
- } else {
- try {
- text = _code_generator__WEBPACK_IMPORTED_MODULE_5__.elementExpressionCode(command.expression);
- } catch (ex) {
- text = "";
- }
- }
- }
- var ok_button = $('<i class="ui icon check circle expression-edit-confirm"></i>');
- var cancel_button = $('<i class="ui icon undo expression-edit-cancel"></i>');
- var input = $('<input type="text" spellcheck="false" autocomplete="off" class="input-expression-field" >');
- input.val(text);
- input.focusout(function (evt) {
- ok_button.click();
- evt.preventDefault();
- return true;
- });
- input.keyup(function (evt) {
- if (evt.keyCode == 27) {
- // esc
- cancel_button.click();
- }
- if (evt.keyCode == 13) {
- // enter
- ok_button.click();
- }
- });
- ok_button.click(function () {
- var parsed = null;
- parsed = _generic_expression__WEBPACK_IMPORTED_MODULE_4__.expressionParserToVisual(input.val(), function_obj, input);
- if (parsed) {
- window.expressionEdition = false;
- command.expression = parsed;
- renderAlgorithm();
- }
- });
- cancel_button.mousedown(function (evt) {
- var parsed = _generic_expression__WEBPACK_IMPORTED_MODULE_4__.expressionParserToVisual(text, function_obj, input);
- if (parsed) {
- window.expressionEdition = false;
- command.expression = parsed;
- renderAlgorithm();
- }
- });
- input.insertAfter(afterWhichElement);
- input.focus();
- cancel_button.insertAfter(input);
- ok_button.insertAfter(input);
- var len = text.length;
- input[0].setSelectionRange(len, len);
- afterWhichElement.css('display', 'none');
- lockButton.css('display', 'none');
- editButton.css('display', 'none');
- ok_button.popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_edit_expression_confirm"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- cancel_button.popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_edit_expression_cancel"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- });
- dowhiletrue_dom.find('.minimize_block_button').on('click', function (evt) {
- dowhiletrue_dom.children('.ui.block_commands').toggle();
- command.collapsed = !command.collapsed;
- });
- $(dowhiletrue_dom.find('.textual_expression')[0]).toggle();
- dowhiletrue_dom.find('.button_alternate_expression').on('click', function () {
- if (command.expression) {
- var text = _code_generator__WEBPACK_IMPORTED_MODULE_5__.elementExpressionCode(command.expression);
- if (text) {
- $(dowhiletrue_dom.find('.conditional_expression')[dowhiletrue_dom.find('.conditional_expression').length - 1]).toggle();
- $(dowhiletrue_dom.find('.textual_expression')[dowhiletrue_dom.find('.textual_expression').length - 1]).text(text);
- $(dowhiletrue_dom.find('.textual_expression')[dowhiletrue_dom.find('.textual_expression').length - 1]).toggle();
- $(this).toggleClass('unlock').toggleClass('lock');
- command.lockexpression = !command.lockexpression;
- }
- }
- if (command.lockexpression) {
- dowhiletrue_dom.find('.lock').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_unlock_expression"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- } else {
- dowhiletrue_dom.find('.unlock').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_lock_expression"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- }
- });
- dowhiletrue_dom.find('.button_remove_command').on('click', function () {
- if (_commands__WEBPACK_IMPORTED_MODULE_1__.removeCommand(command, function_obj, dowhiletrue_dom)) {
- dowhiletrue_dom.fadeOut(400, function () {
- dowhiletrue_dom.remove();
- });
- }
- });
- }
- /***/ }),
- /***/ "./js/visualUI/commands/functioncall.js":
- /*!**********************************************!*\
- !*** ./js/visualUI/commands/functioncall.js ***!
- \**********************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "createFloatingCommand": () => (/* binding */ createFloatingCommand),
- /* harmony export */ "renderCommand": () => (/* binding */ renderCommand)
- /* harmony export */ });
- /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
- /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
- function createFloatingCommand() {
- return $('<div class="ui functioncall created_element"> <i class="hand point right icon"></i> <span> funcao() </span></div>');
- }
- function renderCommand(command, function_obj) {
- 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>');
- el.data('command', command);
- _variable_value_menu__WEBPACK_IMPORTED_MODULE_0__.renderMenu(command, command.function_called, el.find('.var_value_menu_div'), function_obj);
- addHandlers(command, function_obj, el);
- return el;
- }
- function addHandlers(command, function_obj, functioncall_dom) {
- functioncall_dom.find('.button_remove_command').on('click', function () {
- if (_commands__WEBPACK_IMPORTED_MODULE_1__.removeCommand(command, function_obj, functioncall_dom)) {
- functioncall_dom.fadeOut(400, function () {
- functioncall_dom.remove();
- });
- }
- });
- }
- /***/ }),
- /***/ "./js/visualUI/commands/generic_expression.js":
- /*!****************************************************!*\
- !*** ./js/visualUI/commands/generic_expression.js ***!
- \****************************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "renderExpression": () => (/* binding */ renderExpression),
- /* harmony export */ "expressionParserToVisual": () => (/* binding */ expressionParserToVisual),
- /* harmony export */ "searchFunction": () => (/* binding */ searchFunction),
- /* harmony export */ "expressionParserCodeVisual": () => (/* binding */ expressionParserCodeVisual)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "./node_modules/@babel/runtime/helpers/toConsumableArray.js");
- /* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
- /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
- /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
- /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
- /* harmony import */ var _services_userLog__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../services/userLog */ "./js/services/userLog.js");
- /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
- /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(melanke_watchjs__WEBPACK_IMPORTED_MODULE_6__);
- /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../utils */ "./js/visualUI/utils.js");
- window.timer = false;
- function renderExpression(command, function_obj, div_to_render, expression_array) {
- div_to_render.empty();
- melanke_watchjs__WEBPACK_IMPORTED_MODULE_6___default().unwatch(command, "expression");
- melanke_watchjs__WEBPACK_IMPORTED_MODULE_6___default().watch(command, "expression", function () {
- if (window.timer) return;
- var m = div_to_render.find(".single_element_expression").not(".mouse_distance").not(".add_parentheses");
- var s = "";
- m.each(function (e) {
- if ($(this).hasClass("parentheses_in_expression")) {
- s += $(this).text() + " ";
- } else {
- s += $(this).find(".text").text();
- s += $(this).find(".var_name").text();
- s += $(this).find(".parameters_function_called").text();
- s += $(this).find(".value_rendered").text();
- s += " ";
- }
- });
- if (s) {
- window.timer = true;
- } else {
- return;
- }
- (0,_services_userLog__WEBPACK_IMPORTED_MODULE_5__.registerUserEvent)(function_obj.name, _services_userLog__WEBPACK_IMPORTED_MODULE_5__.ActionTypes.CHANGE_COMMAND_EXP, command.type, "/", s);
- setTimeout(function () {
- window.timer = false;
- }, 200);
- }, 20, true);
- if (command.type === _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.COMMAND_TYPES.attribution) {
- melanke_watchjs__WEBPACK_IMPORTED_MODULE_6___default().unwatch(command.variable);
- melanke_watchjs__WEBPACK_IMPORTED_MODULE_6___default().watch(command.variable, function () {
- renderExpression(command, function_obj, div_to_render, expression_array);
- }, 0);
- if (command.variable.content) {
- var types_included = [];
- if (command.variable.content.type == _types__WEBPACK_IMPORTED_MODULE_1__.Types.INTEGER || command.variable.content.type == _types__WEBPACK_IMPORTED_MODULE_1__.Types.REAL) {
- types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_arithmetic);
- } else if (command.variable.content.type == _types__WEBPACK_IMPORTED_MODULE_1__.Types.BOOLEAN) {
- types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_conditional);
- types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_logic);
- types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_arithmetic);
- } else if (command.variable.content.type == _types__WEBPACK_IMPORTED_MODULE_1__.Types.TEXT) {
- types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_conditional);
- types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_logic);
- types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_arithmetic);
- } else {//console.log("NÃO RECONHECI! VEJA: ", command.variable.content.type);
- }
- renderElements(command, function_obj, div_to_render, expression_array, types_included);
- } else {
- div_to_render.text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI("var_menu_select_var").toLowerCase());
- }
- } else {
- var _types_included = [];
- _types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_conditional);
- _types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_logic);
- 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);
- _types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_arithmetic);
- renderElements(command, function_obj, div_to_render, expression_array, _types_included);
- }
- div_to_render.children(".mouse_distance").addClass("mouse_distance_hidden");
- div_to_render.children(".higher_element").on("mousemove", function (evt) {
- if (!window.open_or_close) {
- $(this).css("position", "relative", "!important");
- $(this).children(".mouse_distance").css("opacity", "1");
- }
- });
- div_to_render.children(".higher_element").on("mouseout", function (evt) {
- if (!window.open_or_close) {
- $(this).css("position", "absolute", "!important");
- $(this).children(".mouse_distance").css("opacity", "0");
- }
- });
- var lixeira = $('<div class="lixeira" draggable="true"></div>');
- div_to_render.find(".single_element_expression").on("mousedown", function (evt) {
- window.posX = evt.clientX;
- window.posY = evt.clientY;
- });
- Sortable.create(div_to_render[0], {
- animation: 100,
- ghostClass: "ghost",
- group: {
- name: "shared",
- put: false // Do not allow items to be put into this list
- },
- draggable: ".single_element_expression",
- sort: false,
- filter: ".not_allowed",
- onStart: function onStart() {
- $("body").append(lixeira);
- lixeira.css("display", "block");
- lixeira.css("top", window.posY + 70, "!important");
- lixeira.css("left", window.posX - 20, "!important");
- },
- onMove: function onMove() {
- lixeira.addClass("color_test");
- },
- onEnd: function onEnd() {
- lixeira.remove();
- div_to_render.find(".ghost").removeClass("ghost");
- }
- });
- new Sortable(lixeira[0], {
- group: "shared",
- animation: 150,
- onAdd: function onAdd(evt) {
- lixeira.css("display", "none");
- lixeira.find(".single_element_expression").remove();
- lixeira.css("background-color", "");
- lixeira.remove();
- removeElement(evt, expression_array);
- renderExpression(command, function_obj, div_to_render, expression_array);
- }
- });
- }
- function removeElement(event, expression_array) {
- var indice = $(event.item).data("index");
- var first = expression_array[0];
- if (expression_array[indice].type) {
- // if is alone in expression:
- if (expression_array.length == 1) {
- //function_obj.commands.splice(function_obj.commands.indexOf(command), 1);
- expression_array.splice(0, 1);
- } else if (expression_array.length > 1) {
- if (indice > 0 && expression_array[indice - 1].type_op) {
- if (indice < expression_array.length && expression_array[indice - 2] == "(" && expression_array[indice + 1].type_op) {
- expression_array.splice(indice + 1, 1);
- }
- expression_array.splice(indice, 1);
- expression_array.splice(indice - 1, 1);
- if (indice - 2 < expression_array.length && expression_array[indice - 2] == "(" && expression_array[indice - 1] == ")") {
- expression_array.splice(indice - 1, 1);
- expression_array.splice(indice - 2, 1);
- if (indice - 3 >= 0 && indice - 3 < expression_array.length && expression_array[indice - 3].type_op) {
- expression_array.splice(indice - 3, 1);
- }
- }
- } else if (indice < expression_array.length - 1 && expression_array[indice + 1].type_op) {
- expression_array.splice(indice + 1, 1);
- expression_array.splice(indice, 1);
- } else if (indice < expression_array.length - 1 && indice > 0 && expression_array[indice - 1] == "(" && expression_array[indice + 1] == ")") {
- if (indice > 1 && expression_array[indice - 2].type_op) {
- expression_array.splice(indice + 1, 1);
- expression_array.splice(indice, 1);
- expression_array.splice(indice - 1, 1);
- expression_array.splice(indice - 2, 1);
- } else if (indice < expression_array.length - 2 && expression_array[indice + 2].type_op) {
- expression_array.splice(indice + 1, 1);
- expression_array.splice(indice, 1);
- expression_array.splice(indice - 1, 1);
- } else {
- expression_array.splice(indice + 1, 1);
- expression_array.splice(indice, 1);
- expression_array.splice(indice - 1, 1);
- }
- }
- }
- } else if (expression_array[indice].type_op) {// iVProg doesn't support operator remove
- } else {
- var opening = -1;
- var closing = -1;
- if (expression_array[indice] == "(") {
- opening = indice;
- for (var i = indice + 1; i < expression_array.length; i++) {
- if (expression_array[i] == ")") {
- closing = i;
- break;
- }
- }
- } else {
- closing = indice;
- for (var i = indice - 1; i >= 0; i--) {
- if (expression_array[i] == "(") {
- opening = i;
- break;
- }
- }
- }
- if (expression_array[opening + 1].type_op) {
- expression_array.splice(closing, 1);
- expression_array.splice(opening + 1, 1);
- expression_array.splice(opening, 1);
- } else {
- expression_array.splice(closing, 1);
- expression_array.splice(opening, 1);
- }
- } // if expression is empty, add a new var value:
- if (expression_array.length == 0) {
- 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));
- }
- if (first != expression_array[0] && expression_array[0].type_op) {
- expression_array.splice(0, 1);
- }
- }
- function renderElements(command, function_obj, div_to_render, expression_array, types_included) {
- /*if (expression_array.length > 0) {
- if (!expression_array[0].type_op) {
- renderStartAddOperator(div_to_render, types_included, expression_array, command, function_obj, 0);
- }
- }*/
- var i = 0;
- for (i = 0; i < expression_array.length; i++) {
- if (expression_array[i].type == "var_value") {
- var div_temp = $('<div class="single_element_expression" data-index="' + i + '"></div>');
- if (i == 0) {
- if (expression_array.length > 0 && !expression_array[0].type_op) {//renderStartAddOperator(div_to_render, types_included, expression_array, command, function_obj, 0);
- }
- }
- _variable_value_menu__WEBPACK_IMPORTED_MODULE_4__.renderMenu(command, expression_array[i], div_temp, function_obj);
- div_to_render.append(div_temp);
- } else if (expression_array[i] == "(" || expression_array[i] == ")") {
- if (expression_array[i] == ")") {
- renderFinalAddElements(div_to_render, types_included, expression_array, command, function_obj, i);
- renderParenthesis(div_to_render, expression_array[i], command, function_obj, i, expression_array);
- } else if (expression_array[i] == "(" && !expression_array[i + 1].type_op) {
- renderParenthesis(div_to_render, expression_array[i], command, function_obj, i, expression_array);
- renderStartAddOperator(div_to_render, types_included, expression_array, command, function_obj, i + 1);
- } else {
- renderParenthesis(div_to_render, expression_array[i], command, function_obj, i, expression_array);
- }
- } else {
- if (i == 0) {} else if (expression_array[i - 1] == "(") {}
- renderOperatorMenu(command, function_obj, div_to_render, expression_array[i], types_included, i, expression_array);
- }
- }
- renderFinalAddElements(div_to_render, types_included, expression_array, command, function_obj, i, true);
- renderAddParenthesis(command, function_obj, div_to_render, expression_array, types_included);
- }
- window.parentheses_activate = false;
- window.open_or_close = null;
- function renderAddParenthesis(command, function_obj, div_to_render, expression_array, types_included) {
- 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>');
- div_to_render.append(addParentheses);
- addParentheses.popup({
- content: "Adicionar parênteses",
- delay: {
- show: 750,
- hide: 0
- }
- });
- addParentheses.on("click", function (mouse_event) {
- // verificar se já está ativado
- if (window.parentheses_activate) {
- return;
- }
- div_to_render.find(".usepointer").off("click");
- window.parentheses_activate = true;
- window.open_or_close = "open";
- div_to_render.find(".dropdown").addClass("disabled");
- div_to_render.find(".ghost_element").addClass("temp_class");
- div_to_render.find(".ghost_element").removeClass("ghost_element");
- var floatingObject = $('<div class="floating_parenthesis"> ( </div>');
- floatingObject.draggable().appendTo("body");
- floatingObject.css("position", "absolute");
- mouse_event.type = "mousedown.draggable";
- mouse_event.target = floatingObject[0];
- floatingObject.css("left", mouse_event.pageX + 10);
- floatingObject.css("top", mouse_event.pageY + 10);
- floatingObject.trigger(mouse_event);
- div_to_render.on("mousemove", function (evt) {
- var actual_target = null;
- if ($(evt.target).hasClass("single_element_expression")) {
- actual_target = $(evt.target);
- } else {
- actual_target = $(evt.target).closest(".single_element_expression");
- }
- 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")) {
- return;
- }
- renderGhostParentheses(actual_target, command, function_obj, div_to_render, expression_array);
- });
- div_to_render.on("mouseleave", function () {
- /*window.open_parentheses.remove();
- window.close_parentheses.remove();*/
- });
- var floating;
- $("body").on("mouseup", function (evt) {
- if (window.open_or_close == "open") {
- window.open_or_close = "close";
- floatingObject.remove();
- var comando_que_esta = $(evt.target).closest(".command_container");
- var comando_certo = div_to_render.closest(".command_container");
- if (!comando_que_esta.is(comando_certo)) {
- window.parentheses_activate = false;
- div_to_render.find(".temp_class").addClass("ghost_element");
- div_to_render.find(".temp_class").removeClass("temp_class");
- div_to_render.off("mousemove");
- div_to_render.off("mouseleave");
- $("body").off("mouseup");
- window.open_parentheses.remove();
- window.close_parentheses.remove();
- window.inserir_open = -1;
- window.inserir_close = -1;
- window.open_or_close = null;
- renderExpression(command, function_obj, div_to_render, expression_array);
- return;
- }
- window.open_parentheses.addClass("parentheses_fixed");
- floating = $('<div class="floating_parenthesis"> ) </div>');
- floating.draggable().appendTo("body");
- floating.css("position", "absolute");
- floating.css("left", evt.pageX + 10);
- floating.css("top", evt.pageY + 10);
- $("body").on("mousemove", function (evts) {
- floating.css("left", evts.pageX + 10);
- floating.css("top", evts.pageY + 10);
- });
- } else {
- floating.remove();
- window.open_parentheses.removeClass("parentheses_fixed");
- div_to_render.off("mousemove");
- div_to_render.off("mouseleave");
- $("body").off("mouseup");
- setTimeout(function () {
- window.parentheses_activate = false;
- }, 50);
- var comando_que_esta = $(evt.target).closest(".command_container");
- var comando_certo = div_to_render.closest(".command_container");
- var is_correct = false;
- if (comando_que_esta.is(comando_certo)) {
- is_correct = true;
- }
- if (is_correct) {
- expression_array.splice(window.inserir_open, 0, "(");
- expression_array.splice(window.inserir_close, 0, ")");
- }
- window.inserir_open = -1;
- window.inserir_close = -1;
- window.open_or_close = null;
- renderExpression(command, function_obj, div_to_render, expression_array);
- }
- });
- });
- }
- window.open_parentheses = $('<div class="parentheses_ghost">(</div>');
- window.close_parentheses = $('<div class="parentheses_ghost">)</div>');
- window.inserir_open = -1;
- window.inserir_close = -1;
- function renderGhostParentheses(actual_target, command, function_obj, div_to_render, expression_array) {
- /*window.open_parentheses.remove();
- window.close_parentheses.remove();*/
- var index_in_array = actual_target.data("index");
- if (expression_array[index_in_array] == "(" || expression_array[index_in_array] == ")") {
- return;
- }
- if (window.open_or_close == "close") {
- if (index_in_array < window.inserir_open) {
- return;
- }
- } // Tratando a situação quando é na primeira posição:
- if (index_in_array == 0) {
- if (expression_array[index_in_array].type == "var_value") {
- if (window.open_or_close == "open") {
- window.open_parentheses.insertBefore(actual_target);
- window.inserir_open = index_in_array;
- }
- /*if (expression_array.length == 1) {
- if (window.open_or_close == "close") {
- window.close_parentheses.insertAfter(actual_target);
- window.inserir_close = index_in_array + 2;
- }*/
- //} else {
- var count_opened = 0;
- var count_closed = 0;
- for (var i = 0; i < expression_array.length; i++) {
- if (expression_array[i] == "(") {
- count_opened++;
- }
- if (expression_array[i] == ")") {
- count_closed++;
- }
- if (count_opened != count_closed) {} else {
- if (count_opened > 0) {
- if (window.open_or_close == "close") {
- window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="' + i + '"]'));
- window.inserir_close = i + 2;
- }
- break;
- } else {
- if (expression_array[i].type == "var_value") {
- if (window.open_or_close == "close") {
- window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="' + i + '"]'));
- window.inserir_close = i + 2;
- }
- break;
- }
- }
- }
- } //}
- } else if (expression_array[index_in_array].type_op) {
- if (window.open_or_close == "open") {
- window.open_parentheses.insertBefore(actual_target);
- window.inserir_open = index_in_array;
- }
- var count_opened = 0;
- var count_closed = 0;
- for (var i = 1; i < expression_array.length; i++) {
- // $('.slide-link[data-slide="0"]')
- if (expression_array[i] == "(") {
- count_opened++;
- }
- if (expression_array[i] == ")") {
- count_closed++;
- }
- if (count_opened != count_closed) {} else {
- if (count_opened > 0) {
- if (expression_array[i].type == "var_value") {
- window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="' + i + '"]'));
- window.inserir_close = i + 2;
- }
- break;
- } else {
- if (expression_array[i].type == "var_value") {
- if (expression_array[i].type == "var_value") {
- window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="' + i + '"]'));
- window.inserir_close = i + 2;
- }
- break;
- }
- }
- }
- }
- }
- return;
- } // Tratando quando não é no índice 0:
- if (expression_array[index_in_array].type == "var_value") {
- if (window.open_or_close == "open") {
- window.open_parentheses.insertBefore(actual_target);
- window.inserir_open = index_in_array;
- }
- if (window.open_or_close == "close") {
- window.close_parentheses.insertAfter(actual_target);
- window.inserir_close = index_in_array + 2;
- }
- return;
- }
- if (expression_array[index_in_array].type_op) {
- // buscar para a esquerda primeiro:
- if (expression_array[index_in_array - 1] == "(") {
- if (window.open_or_close == "open") {
- window.open_parentheses.insertBefore(actual_target);
- window.inserir_open = index_in_array;
- }
- } else if (expression_array[index_in_array - 1] == ")") {
- // buscar a abertura
- var count_opened = 0;
- var count_closed = 0;
- for (var j = index_in_array - 1; j >= 0; j--) {
- if (expression_array[j] == "(") {
- count_opened++;
- }
- if (expression_array[j] == ")") {
- count_closed++;
- }
- if (count_opened != count_closed) {} else {
- if (count_closed > 0) {
- if (window.open_or_close == "open") {
- window.open_parentheses.insertBefore(div_to_render.find('.single_element_expression[data-index="' + j + '"]'));
- window.inserir_open = j;
- }
- break;
- }
- }
- }
- } else if (expression_array[index_in_array - 1].type == "var_value") {
- if (window.open_or_close == "open") {
- window.open_parentheses.insertBefore(div_to_render.find('.single_element_expression[data-index="' + (index_in_array - 1) + '"]'));
- window.inserir_open = index_in_array - 1;
- }
- } // buscar para a direita agora:
- if (expression_array[index_in_array + 1] == "(") {
- // buscar o fechamento:
- var count_opened = 0;
- var count_closed = 0;
- for (var j = index_in_array + 1; j < expression_array.length; j++) {
- if (expression_array[j] == "(") {
- count_opened++;
- }
- if (expression_array[j] == ")") {
- count_closed++;
- }
- if (count_opened != count_closed) {} else {
- if (count_opened > 0) {
- if (window.open_or_close == "close") {
- window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="' + j + '"]'));
- window.inserir_close = j + 2;
- }
- break;
- }
- }
- }
- } else if (expression_array[index_in_array + 1].type == "var_value") {
- if (window.open_or_close == "close") {
- window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="' + (index_in_array + 1) + '"]'));
- window.inserir_close = index_in_array + 3;
- }
- }
- }
- }
- function renderParenthesis(div_to_render, expression_content, command, function_obj, position, expression_array) {
- var ghost_parenthesis = $('<div class="single_element_expression parentheses_in_expression" data-index="' + position + '">' + expression_content + "</div>");
- div_to_render.append(ghost_parenthesis);
- }
- function renderStartAddOperator(div_to_render, types_included, expression_array, command, function_obj, position) {
- var menu_final = '<div class="ui dropdown disabled usepointer"><div class="text"> + </div><i class="dropdown icon"></i><div class="menu">';
- if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_arithmetic) >= 0) {
- if (types_included.length > 1) {
- menu_final += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI("text_arithmetic_expression") + '<div class="menu">';
- menu_final += getArithmeticOperators();
- menu_final += "</div></div>";
- } else {
- menu_final += getArithmeticOperators();
- }
- }
- if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_logic) >= 0) {
- if (types_included.length > 1) {
- menu_final += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI("text_logic_expression") + '<div class="menu">';
- menu_final += getLogicOperators();
- menu_final += "</div></div>";
- } else {
- menu_final += getLogicOperators();
- }
- }
- if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_conditional) >= 0) {
- if (types_included.length > 1) {
- menu_final += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI("text_relational_expression") + '<div class="menu">';
- menu_final += getRelationalOperators();
- menu_final += "</div></div>";
- } else {
- menu_final += getRelationalOperators();
- }
- }
- menu_final += "</div></div>";
- menu_final = $(menu_final);
- var div_temp = $('<div class="single_element_expression ghost_element mouse_distance"></div>');
- div_temp.append(menu_final);
- var div_higher = $('<div class="higher_element"></div>');
- div_higher.append(div_temp);
- div_to_render.append(div_higher);
- menu_final.dropdown("set selected", _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ARITHMETIC_TYPES.minus);
- div_temp.on("click", function () {
- if (!window.open_or_close) {
- var sera = position;
- if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_arithmetic) >= 0) {
- 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));
- } else if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_logic) >= 0) {
- 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));
- } else if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_conditional) >= 0) {
- 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));
- }
- renderExpression(command, function_obj, div_to_render, expression_array);
- }
- });
- }
- function renderFinalAddElements(div_to_render, types_included, expression_array, command, function_obj, position) {
- var is_last = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
- var menu_final = '<div class="ui dropdown disabled usepointer"><div class="text"> + </div><i class="dropdown icon"></i><div class="menu">';
- if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_arithmetic) >= 0) {
- if (types_included.length > 1) {
- menu_final += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI("text_arithmetic_expression") + '<div class="menu">';
- menu_final += getArithmeticOperators();
- menu_final += "</div></div>";
- } else {
- menu_final += getArithmeticOperators();
- }
- }
- if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_logic) >= 0) {
- if (types_included.length > 1) {
- menu_final += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI("text_logic_expression") + '<div class="menu">';
- menu_final += getLogicOperators();
- menu_final += "</div></div>";
- } else {
- menu_final += getLogicOperators();
- }
- }
- if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_conditional) >= 0) {
- if (types_included.length > 1) {
- menu_final += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI("text_relational_expression") + '<div class="menu">';
- menu_final += getRelationalOperators();
- menu_final += "</div></div>";
- } else {
- menu_final += getRelationalOperators();
- }
- }
- menu_final += "</div></div>";
- menu_final = $(menu_final);
- var div_temp = $('<div class="simple_add mouse_distance"></div>');
- var div_higher = $('<div class="higher_element"></div>');
- var button = $('<button class="ui button green add_expression"><i class="plus circle inverted icon"></i></button>');
- div_temp.append(button);
- if (!is_last) {
- div_higher.append(div_temp);
- div_to_render.append(div_higher); //div_temp.append(menu_final);
- div_temp.css("opacity", "0", "!important");
- } else {
- div_temp.removeClass("mouse_distance");
- div_temp.css("opacity", "1", "!important"); //div_temp.append(menu_final);
- div_to_render.append(div_temp);
- }
- menu_final.dropdown("set selected", _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ARITHMETIC_TYPES.plus);
- div_temp.on("click", function () {
- var sera = position;
- if (expression_array[sera] == ")" && expression_array[sera - 1] == "(") {
- 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));
- renderExpression(command, function_obj, div_to_render, expression_array);
- return;
- }
- if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_arithmetic) >= 0) {
- 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));
- 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));
- } else if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_logic) >= 0) {
- 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));
- 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));
- } else if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_conditional) >= 0) {
- 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));
- 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));
- }
- renderExpression(command, function_obj, div_to_render, expression_array);
- });
- }
- function renderOperatorMenu(command, function_obj, div_to_render, expression_element, types_included, position, expression_array) {
- var menu_final = '<div class="ui dropdown"><div class="text"> + </div><i class="dropdown icon"></i><div class="menu">';
- if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.write_sep) >= 0) {
- menu_final += getSeparator();
- }
- if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_arithmetic) >= 0) {
- if (types_included.length > 1) {
- menu_final += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI("text_arithmetic_expression") + '<div class="menu">';
- menu_final += getArithmeticOperators();
- menu_final += "</div></div>";
- } else {
- menu_final += getArithmeticOperators();
- }
- }
- if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_logic) >= 0) {
- if (types_included.length > 1) {
- menu_final += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI("text_logic_expression") + '<div class="menu">';
- menu_final += getLogicOperators();
- menu_final += "</div></div>";
- } else {
- menu_final += getLogicOperators();
- }
- }
- if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_conditional) >= 0) {
- if (types_included.length > 1) {
- menu_final += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI("text_relational_expression") + '<div class="menu">';
- menu_final += getRelationalOperators();
- menu_final += "</div></div>";
- } else {
- menu_final += getRelationalOperators();
- }
- }
- menu_final += "</div></div>";
- menu_final = $(menu_final);
- menu_final.find(".ivprog-write-sep").popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI("write_seprator_menu_tooltip"),
- delay: {
- show: 500,
- hide: 0
- }
- });
- var div_temp = $('<div class="single_element_expression not_allowed" data-index="' + position + '"></div>');
- div_temp.append(menu_final);
- div_to_render.append(div_temp);
- menu_final.dropdown({
- onChange: function onChange(_value, _text, $selectedItem) {
- expression_element.item = $selectedItem.data("value");
- expression_element.type_op = $selectedItem.data("type");
- }
- });
- menu_final.dropdown("set selected", expression_element.item);
- }
- function getArithmeticOperators() {
- var arithmetic_operators;
- 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>';
- 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>';
- 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>';
- 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>';
- 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>';
- return arithmetic_operators;
- }
- function getLogicOperators() {
- var logic_operators;
- 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>';
- 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>';
- 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>";
- 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>";
- 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>";
- return logic_operators;
- }
- function getRelationalOperators() {
- var relational_operators;
- 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>';
- 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>';
- 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>';
- 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>';
- 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>';
- 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>';
- return relational_operators;
- }
- function getSeparator() {
- 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>");
- }
- function getVariable(function_obj, search) {
- if (search == ")" || search == "(") {
- return search;
- }
- if (search.instance == "operator") {
- var obj;
- switch (search.value) {
- case '+':
- 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);
- break;
- case '-':
- 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);
- break;
- case '*':
- 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);
- break;
- case '/':
- 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);
- break;
- case '%':
- 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);
- break;
- case '>':
- 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);
- break;
- case '<':
- 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);
- break;
- case '>=':
- 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);
- break;
- case '<=':
- 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);
- break;
- case '==':
- 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);
- break;
- case '!=':
- 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);
- break;
- case 'and':
- 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);
- break;
- case 'or':
- 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);
- break;
- case 'not':
- 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);
- break;
- }
- return obj;
- }
- if (search.instance == "expression" && search.type == "const") {
- if (search.value === true) {
- 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);
- return obj;
- }
- if (search.value === false) {
- 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);
- return obj;
- }
- 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);
- return obj;
- }
- var variavel = null;
- if (search.instance == "expression" && search.type == "var") {
- // 1. Procurar a variável na função:
- for (var j = 0; j < function_obj.variables_list.length; j++) {
- if (function_obj.variables_list[j].name == search.value) {
- variavel = function_obj.variables_list[j];
- break;
- }
- } // 2. Procurar a variável nas gloais:
- if (!variavel) for (var j = 0; j < program_obj.globals.length; j++) {
- if (program_obj.globals[j].name == search.value) {
- variavel = program_obj.globals[j];
- break;
- }
- } // 3. Procurar na lista de parâmetros:
- if (!variavel) for (var j = 0; j < function_obj.parameters_list.length; j++) {
- if (function_obj.parameters_list[j].name == search.value) {
- variavel = function_obj.parameters_list[j];
- break;
- }
- }
- }
- if (search.instance == "expression" && search.type == "var" && !search.line) {
- 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);
- return obj;
- }
- if (search.instance == "expression" && search.type == "var" && search["class"] == "vector") {
- 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);
- return obj;
- }
- if (search.instance == "expression" && search.type == "var" && search["class"] == "matrix") {
- 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);
- return obj;
- }
- if (search.instance == "expression" && search.type == "function") {
- 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:
- for (var i = 0; i < program_obj.functions.length; i++) {
- if (program_obj.functions[i].name == search.value) {
- obj.function_called = program_obj.functions[i];
- }
- } // Se ainda não foi encontrada, procurar na biblioteca do iVProg:
- if (!obj.function_called) {
- for (var i = 0; i < window.system_functions.length; i++) {
- if (search.value.split(".")[1] && search.value.split(".")[1] == window.system_functions[i].identifier) {
- obj.function_called = window.system_functions[i];
- } else if (search.value == window.system_functions[i].identifier) {
- obj.function_called = window.system_functions[i];
- }
- }
- }
- obj.parameters_list = [];
- for (var i = 0; i < search.params.length; i++) {
- obj.parameters_list.push(getVariable(function_obj, search.params[i][0]));
- }
- return obj;
- }
- }
- function expressionParserToVisual(text, function_obj, input_field) {
- if (text.trim().length == 0) {
- 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)];
- }
- var var_not_found = [];
- var fun_not_found = [];
- var parsed;
- try {
- parsed = ivprogCore.parseExpression(text);
- } catch (ex) {
- _utils__WEBPACK_IMPORTED_MODULE_7__.renderErrorMessage(input_field, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI('expression_invalid'));
- }
- if (!parsed) return null;
- for (var i = 0; i < parsed.length; i++) {
- var variavel = null;
- if (parsed[i].instance == "expression" && parsed[i].type == "var") {
- // 1. Procurar a variável na função:
- for (var j = 0; j < function_obj.variables_list.length; j++) {
- if (function_obj.variables_list[j].name == parsed[i].value) {
- variavel = function_obj.variables_list[j];
- break;
- }
- } // 2. Procurar a variável nas globais:
- if (!variavel) for (var j = 0; j < program_obj.globals.length; j++) {
- if (program_obj.globals[j].name == parsed[i].value) {
- variavel = program_obj.globals[j];
- break;
- }
- } // 3. Procurar a variável nos parâmetros:
- if (!variavel) for (var j = 0; j < function_obj.parameters_list.length; j++) {
- if (function_obj.parameters_list[j].name == parsed[i].value) {
- variavel = function_obj.parameters_list[j];
- break;
- }
- }
- if (!variavel) var_not_found.push(parsed[i].value);
- }
- var funcao;
- if (parsed[i].instance == "expression" && parsed[i].type == "function") {
- // Procurar a função para referência:
- for (var j = 0; j < program_obj.functions.length; j++) {
- if (program_obj.functions[j].name == parsed[i].value) {
- funcao = program_obj.functions[j];
- }
- } // Se ainda não encontrou, procurar na biblioteca do iVProg:
- if (!funcao) {
- for (var j = 0; j < window.system_functions.length; j++) {
- if (parsed[i].value.split(".")[1] && parsed[i].value.split(".")[1] == window.system_functions[j].identifier) {
- funcao = window.system_functions[j];
- } else if (parsed[i].value == window.system_functions[j].identifier) {
- funcao = window.system_functions[j];
- }
- }
- }
- if (!funcao) {
- fun_not_found.push(parsed[i].value);
- }
- }
- }
- if (fun_not_found.length > 0) {
- var uniqueWords = _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default()(new Set(fun_not_found));
- _utils__WEBPACK_IMPORTED_MODULE_7__.renderErrorMessage(input_field, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI('expression_undeclared_function') + " " + uniqueWords.join(", "));
- return null;
- }
- if (var_not_found.length > 0) {
- var _uniqueWords = _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default()(new Set(var_not_found));
- _utils__WEBPACK_IMPORTED_MODULE_7__.renderErrorMessage(input_field, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI('expression_undelcared_variable') + " " + _uniqueWords.join(", "));
- return null;
- }
- var exp_obj = [];
- for (var i = 0; i < parsed.length; i++) {
- exp_obj.push(getVariable(function_obj, parsed[i]));
- }
- return exp_obj;
- }
- function searchFunction(function_name) {
- for (var j = 0; j < program_obj.functions.length; j++) {
- if (program_obj.functions[j].name == function_name) {
- return program_obj.functions[j];
- }
- } // Se ainda não encontrou, procurar na biblioteca do iVProg:
- for (var j = 0; j < window.system_functions.length; j++) {
- if (function_name.split(".")[1] && function_name.split(".")[1] == window.system_functions[j].identifier) {
- return window.system_functions[j];
- } else if (function_name == window.system_functions[j].identifier) {
- return window.system_functions[j];
- }
- }
- }
- function expressionParserCodeVisual(parsed, function_obj) {
- if (!parsed) return null;
- var var_not_found = [];
- var fun_not_found = [];
- for (var i = 0; i < parsed.length; i++) {
- var variavel = null;
- if (parsed[i].instance == "expression" && parsed[i].type == "var") {
- // 1. Procurar a variável na função:
- for (var j = 0; j < function_obj.variables_list.length; j++) {
- if (function_obj.variables_list[j].name == parsed[i].value) {
- variavel = function_obj.variables_list[j];
- break;
- }
- } // 2. Procurar a variável nas globais:
- if (!variavel) for (var j = 0; j < program_obj.globals.length; j++) {
- if (program_obj.globals[j].name == parsed[i].value) {
- variavel = program_obj.globals[j];
- break;
- }
- } // 3. Procurar a variável nos parâmetros:
- if (!variavel) for (var j = 0; j < function_obj.parameters_list.length; j++) {
- if (function_obj.parameters_list[j].name == parsed[i].value) {
- variavel = function_obj.parameters_list[j];
- break;
- }
- }
- if (!variavel) var_not_found.push(parsed[i].value);
- }
- var funcao;
- if (parsed[i].instance == "expression" && parsed[i].type == "function") {
- // Procurar a função para referência:
- for (var j = 0; j < program_obj.functions.length; j++) {
- if (program_obj.functions[j].name == parsed[i].value) {
- funcao = program_obj.functions[j];
- }
- } // Se ainda não encontrou, procurar na biblioteca do iVProg:
- if (!funcao) {
- for (var j = 0; j < window.system_functions.length; j++) {
- if (parsed[i].value.split(".")[1] && parsed[i].value.split(".")[1] == window.system_functions[j].identifier) {
- funcao = window.system_functions[j];
- } else if (parsed[i].value == window.system_functions[j].identifier) {
- funcao = window.system_functions[j];
- }
- }
- }
- if (!funcao) {
- fun_not_found.push(parsed[i].value);
- }
- }
- }
- var exp_obj = [];
- for (var i = 0; i < parsed.length; i++) {
- exp_obj.push(getVariable(function_obj, parsed[i]));
- }
- return exp_obj;
- }
- /***/ }),
- /***/ "./js/visualUI/commands/iftrue.js":
- /*!****************************************!*\
- !*** ./js/visualUI/commands/iftrue.js ***!
- \****************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "createFloatingCommand": () => (/* binding */ createFloatingCommand),
- /* harmony export */ "renderCommand": () => (/* binding */ renderCommand)
- /* harmony export */ });
- /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
- /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
- /* harmony import */ var _generic_expression__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./generic_expression */ "./js/visualUI/commands/generic_expression.js");
- /* harmony import */ var _code_generator__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../code_generator */ "./js/visualUI/code_generator.js");
- function createFloatingCommand() {
- return $('<div class="ui iftrue created_element"> <i class="ui icon small random"></i> <span> if (x < 1) { } </span></div>');
- }
- function renderCommand(command, function_obj) {
- var ret = '';
- 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>';
- ret += '<span class="span_command_spec"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI('text_if') + '</span>';
- ret += ' <span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="textual_expression"></span> <span class="span_command_spec"> ) </span> ';
- ret += ' <i class="ui icon i cursor button_write_expression" style="margin-right: 1rem !important;"></i> ';
- ret += '<i class="ui icon unlock button_alternate_expression"></i>';
- ret += '<span> </span> ';
- ret += '<div class="ui block_commands commands_if conditional_comands_block" data-if="true">';
- ret += '</div></div>';
- 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>';
- ret += '<div class="ui block_commands commands_else conditional_comands_block" data-else="true">';
- ret += '</div>';
- ret += '<span></span></div>';
- ret += '</div>';
- var el = $(ret);
- el.data('command', command);
- el.find('.block_commands').data('command', command);
- el.find('.data_block_if').data('command', command);
- el.find('.data_block_else').data('command', command);
- el.find('.commands_if').data('command', command);
- addHandlers(command, function_obj, el); //ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
- _generic_expression__WEBPACK_IMPORTED_MODULE_2__.renderExpression(command, function_obj, el.find('.conditional_expression'), command.expression);
- if (command.commands_block) {
- for (var j = 0; j < command.commands_block.length; j++) {
- _commands__WEBPACK_IMPORTED_MODULE_1__.renderCommand(command.commands_block[j], $(el.find('.commands_if')[0]), 3, function_obj);
- }
- }
- if (command.commands_else) {
- for (var j = 0; j < command.commands_else.length; j++) {
- _commands__WEBPACK_IMPORTED_MODULE_1__.renderCommand(command.commands_else[j], $(el.find('.commands_else')[0]), 3, function_obj);
- }
- }
- if (command.collapsed) {
- el.children('.data_block_else').toggle();
- $(el.find('.block_commands')[0]).toggle();
- }
- if (command.lockexpression) {
- if (command.expression) {
- try {
- var text = _code_generator__WEBPACK_IMPORTED_MODULE_3__.elementExpressionCode(command.expression);
- if (text) {
- $(el.find('.conditional_expression')[0]).toggle();
- $(el.find('.textual_expression')[0]).text(text);
- $(el.find('.textual_expression')[0]).toggle();
- $(el.find('.button_alternate_expression')[0]).toggleClass('unlock').toggleClass('lock');
- }
- } catch (e) {
- command.lockexpression = false;
- }
- }
- }
- el.find('.unlock').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_lock_expression"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- el.find('.lock').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_unlock_expression"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- el.find('.button_write_expression').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_edit_expression"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- return el;
- }
- function addHandlers(command, function_obj, iftrue_dom) {
- iftrue_dom.find('.button_write_expression').on('click', function () {
- window.expressionEdition = true;
- window.inputExpression = null;
- var afterWhichElement;
- var lockButton = $(iftrue_dom.find('.button_alternate_expression')[0]);
- var editButton = $(this);
- afterWhichElement = $(iftrue_dom.find('.conditional_expression')[0]);
- if (command.lockexpression) {
- afterWhichElement = $(iftrue_dom.find('.textual_expression')[0]);
- }
- var text = "";
- if (command.expression) {
- if (command.expression.length == 1 && command.expression[0].content == null && !command.expression[0].function_called) {
- text = "";
- } else {
- try {
- text = _code_generator__WEBPACK_IMPORTED_MODULE_3__.elementExpressionCode(command.expression);
- } catch (ex) {
- text = "";
- }
- }
- }
- var ok_button = $('<i class="ui icon check circle expression-edit-confirm"></i>');
- var cancel_button = $('<i class="ui icon undo expression-edit-cancel"></i>');
- var input = $('<input type="text" spellcheck="false" autocomplete="off" class="input-expression-field" >');
- input.val(text);
- input.focusout(function (evt) {
- ok_button.click();
- evt.preventDefault();
- return true;
- });
- input.keyup(function (evt) {
- if (evt.keyCode == 27) {
- // esc
- cancel_button.click();
- }
- if (evt.keyCode == 13) {
- // enter
- ok_button.click();
- }
- });
- ok_button.click(function () {
- var parsed = null;
- parsed = _generic_expression__WEBPACK_IMPORTED_MODULE_2__.expressionParserToVisual(input.val(), function_obj, input);
- if (parsed) {
- window.expressionEdition = false;
- command.expression = parsed;
- renderAlgorithm();
- }
- });
- cancel_button.mousedown(function (evt) {
- var parsed = _generic_expression__WEBPACK_IMPORTED_MODULE_2__.expressionParserToVisual(text, function_obj, input);
- if (parsed) {
- window.expressionEdition = false;
- command.expression = parsed;
- renderAlgorithm();
- }
- });
- input.insertAfter(afterWhichElement);
- input.focus();
- cancel_button.insertAfter(input);
- ok_button.insertAfter(input);
- var len = text.length;
- input[0].setSelectionRange(len, len);
- afterWhichElement.css('display', 'none');
- lockButton.css('display', 'none');
- editButton.css('display', 'none');
- ok_button.popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_edit_expression_confirm"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- cancel_button.popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_edit_expression_cancel"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- });
- $(iftrue_dom.find('.textual_expression')[0]).toggle();
- iftrue_dom.find('.button_alternate_expression').on('click', function () {
- if (command.expression) {
- var text = _code_generator__WEBPACK_IMPORTED_MODULE_3__.elementExpressionCode(command.expression);
- if (text) {
- $(iftrue_dom.find('.conditional_expression')[0]).toggle();
- $(iftrue_dom.find('.textual_expression')[0]).text(text);
- $(iftrue_dom.find('.textual_expression')[0]).toggle();
- $(this).toggleClass('unlock').toggleClass('lock');
- command.lockexpression = !command.lockexpression;
- }
- }
- if (command.lockexpression) {
- iftrue_dom.find('.lock').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_unlock_expression"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- } else {
- iftrue_dom.find('.unlock').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_lock_expression"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- }
- });
- iftrue_dom.find('.button_remove_command').on('click', function () {
- if (_commands__WEBPACK_IMPORTED_MODULE_1__.removeCommand(command, function_obj, iftrue_dom)) {
- iftrue_dom.fadeOut(400, function () {
- iftrue_dom.remove();
- });
- }
- });
- iftrue_dom.find('.minimize_block_button').on('click', function () {
- iftrue_dom.children('.data_block_else').toggle();
- $(iftrue_dom.find('.block_commands')[0]).toggle();
- command.collapsed = !command.collapsed;
- });
- }
- /***/ }),
- /***/ "./js/visualUI/commands/reader.js":
- /*!****************************************!*\
- !*** ./js/visualUI/commands/reader.js ***!
- \****************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "createFloatingCommand": () => (/* binding */ createFloatingCommand),
- /* harmony export */ "renderCommand": () => (/* binding */ renderCommand)
- /* harmony export */ });
- /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
- /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
- /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
- function createFloatingCommand() {
- 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>');
- }
- function renderCommand(command, function_obj) {
- 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>';
- el = $(el);
- el.data('command', command);
- _variable_value_menu__WEBPACK_IMPORTED_MODULE_1__.renderMenu(command, command.variable_value_menu, el.find('.var_value_menu_div'), function_obj);
- addHandlers(command, function_obj, el);
- return el;
- }
- function addHandlers(command, function_obj, reader_dom) {
- reader_dom.find('.button_remove_command').on('click', function () {
- if (_commands__WEBPACK_IMPORTED_MODULE_2__.removeCommand(command, function_obj, reader_dom)) {
- reader_dom.fadeOut(400, function () {
- reader_dom.remove();
- });
- }
- });
- }
- /***/ }),
- /***/ "./js/visualUI/commands/repeatNtimes.js":
- /*!**********************************************!*\
- !*** ./js/visualUI/commands/repeatNtimes.js ***!
- \**********************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "createFloatingCommand": () => (/* binding */ createFloatingCommand),
- /* harmony export */ "renderCommand": () => (/* binding */ renderCommand),
- /* harmony export */ "manageExpressionElements": () => (/* binding */ manageExpressionElements),
- /* harmony export */ "manageClearExpressionElements": () => (/* binding */ manageClearExpressionElements)
- /* harmony export */ });
- /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
- /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
- /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
- /* harmony import */ var _conditional_expression__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
- /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
- /* harmony import */ var _contextualized_menu__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
- /* harmony import */ var _generic_expression__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./generic_expression */ "./js/visualUI/commands/generic_expression.js");
- /* harmony import */ var _code_generator__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../code_generator */ "./js/visualUI/code_generator.js");
- function createFloatingCommand() {
- 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>');
- }
- function renderCommand(command, function_obj) {
- 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>");
- ret += '<div class="ui block_commands">';
- ret += '</div>';
- ret += '<span> </span>';
- ret += '</div>';
- var el = $(ret);
- el.data('command', command);
- el.find('.block_commands').data('command', command);
- addHandlers(command, function_obj, el);
- _contextualized_menu__WEBPACK_IMPORTED_MODULE_5__.renderMenu(command, el.find('.context_menu'), function_obj, el);
- _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'));
- _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);
- //VariableValueMenu.renderMenu(command, command.var_incrementation, el.find('.incrementation_variable'), function_obj);
- //angle double right
- if (!command.expression1) {
- 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);
- }
- el.find('.text_receives').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_for_from"));
- _variable_value_menu__WEBPACK_IMPORTED_MODULE_4__.renderMenu(command, command.expression1, el.find('.var_value_expression'), function_obj);
- if (!command.expression3) {
- 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>');
- el.find('.pass_button').find('button').on('click', function () {
- togglePasso(command);
- });
- /*var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.exp_op_exp,
- [command.var_attribution,
- Models.ARITHMETIC_TYPES.plus,
- new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, "1", null, null, true)]);
- command.expression3 = exp;
- command.var_incrementation = command.var_attribution;*/
- } else {
- 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>');
- el.find('.pass_button').find('button').on('click', function () {
- togglePasso(command);
- });
- renderOperator(command, function_obj, el.find('.operator'), command.expression3, 1);
- _variable_value_menu__WEBPACK_IMPORTED_MODULE_4__.renderMenu(command, command.expression3.itens[2], el.find('.second_operand'), function_obj);
- }
- if (command.commands_block) {
- for (var j = 0; j < command.commands_block.length; j++) {
- _commands__WEBPACK_IMPORTED_MODULE_2__.renderCommand(command.commands_block[j], $(el.find('.block_commands')[0]), 3, function_obj);
- }
- }
- if (command.lockexpression) {
- try {
- var text = _code_generator__WEBPACK_IMPORTED_MODULE_7__.repeatNtimesHeader(command);
- if (text) {
- $(el.find('.textual_expression')[0]).html(text);
- $(el.find('.textual_expression')[0]).toggle();
- $(el.find('.attribution_expression')[0]).toggle();
- $(el.find('.span_command_spec.separator_character')[0]).toggle();
- $(el.find('.conditional_expression')[0]).toggle();
- $(el.find('.pass_button')[0]).toggle();
- $(el.find('.incrementation_field')[0]).toggle();
- $(el.find('.button_alternate_expression')[0]).toggleClass('unlock').toggleClass('lock');
- }
- } catch (e) {
- command.lockexpression = false;
- }
- }
- el.find('.unlock').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_lock_expression"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- el.find('.lock').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_unlock_expression"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- return el;
- }
- function togglePasso(command) {
- if (!command.expression3) {
- 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)]);
- command.expression3 = exp;
- command.var_incrementation = command.var_attribution;
- } else {
- command.expression3 = null;
- }
- renderAlgorithm();
- }
- function manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element) {
- if (dom_object.hasClass('variable_attribution')) {
- if (!command.expression3) {
- 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)]);
- command.expression3 = exp;
- command.var_incrementation = command.var_attribution;
- 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);
- command.expression2.expression = cond_exp;
- }
- dom_object.parent().find('.text_receives').text('de');
- 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);
- dom_object.parent().find('.var_value_expression').empty();
- _variable_value_menu__WEBPACK_IMPORTED_MODULE_4__.renderMenu(command, command.expression1, dom_object.parent().find('.var_value_expression'), function_obj);
- renderAlgorithm();
- }
- if (dom_object.hasClass('incrementation_variable')) {
- dom_object.parent().find('.text_inc_receives').text('de');
- 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)]);
- command.expression3 = exp;
- _variable_value_menu__WEBPACK_IMPORTED_MODULE_4__.renderMenu(command, command.expression3.itens[0], dom_object.parent().find('.first_operand'), function_obj);
- renderOperator(command, function_obj, dom_object.parent().find('.operator'), command.expression3, 1);
- _variable_value_menu__WEBPACK_IMPORTED_MODULE_4__.renderMenu(command, command.expression3.itens[2], dom_object.parent().find('.second_operand'), function_obj);
- }
- }
- function manageClearExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element) {
- if (dom_object.hasClass('variable_attribution')) {
- $(dom_object).parent().find('.text_receives').text('');
- command.expression1 = null;
- $(dom_object).parent().find('.var_value_expression').empty();
- }
- if (dom_object.hasClass('incrementation_variable')) {
- $(dom_object).parent().find('.text_inc_receives').text('');
- command.expression3 = null;
- $(dom_object).parent().find('.first_operand').empty();
- $(dom_object).parent().find('.operator').empty();
- $(dom_object).parent().find('.second_operand').empty();
- }
- }
- function addHandlers(command, function_obj, repeatNtimes_dom) {
- repeatNtimes_dom.find('.minimize_block_button').on('click', function (evt) {
- repeatNtimes_dom.children('.ui.block_commands').toggle();
- command.collapsed = !command.collapsed;
- });
- $(repeatNtimes_dom.find('.textual_expression')[0]).toggle();
- repeatNtimes_dom.find('.button_alternate_expression').on('click', function () {
- var text = _code_generator__WEBPACK_IMPORTED_MODULE_7__.repeatNtimesHeader(command);
- if (text) {
- $(repeatNtimes_dom.find('.textual_expression')[0]).html(text);
- $(repeatNtimes_dom.find('.textual_expression')[0]).toggle();
- $(repeatNtimes_dom.find('.attribution_expression')[0]).toggle();
- $(repeatNtimes_dom.find('.span_command_spec.separator_character')[0]).toggle();
- $(repeatNtimes_dom.find('.conditional_expression')[0]).toggle();
- $(repeatNtimes_dom.find('.pass_button')[0]).toggle();
- $(repeatNtimes_dom.find('.incrementation_field')[0]).toggle();
- $(repeatNtimes_dom.find('.button_alternate_expression')[0]).toggleClass('unlock').toggleClass('lock');
- command.lockexpression = !command.lockexpression;
- }
- if (command.lockexpression) {
- repeatNtimes_dom.find('.lock').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_unlock_expression"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- } else {
- repeatNtimes_dom.find('.unlock').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_lock_expression"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- }
- });
- repeatNtimes_dom.find('.button_remove_command').on('click', function () {
- if (_commands__WEBPACK_IMPORTED_MODULE_2__.removeCommand(command, function_obj, repeatNtimes_dom)) {
- repeatNtimes_dom.fadeOut(400, function () {
- repeatNtimes_dom.remove();
- });
- }
- });
- }
- function renderOperator(command, function_obj, temp_op, expression_element, index_op) {
- var menu_operator = $('<div class="ui dropdown"><div class="text"></div></div>');
- menu_operator.dropdown({
- values: [{
- name: '+',
- value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.plus,
- selected: expression_element.itens[index_op] == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.plus
- }, {
- name: '-',
- value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.minus,
- selected: expression_element.itens[index_op] == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.minus
- }],
- onChange: function onChange(value, text, $selectedItem) {
- expression_element.itens[index_op] = value;
- }
- });
- temp_op.append(menu_operator);
- }
- /***/ }),
- /***/ "./js/visualUI/commands/return.js":
- /*!****************************************!*\
- !*** ./js/visualUI/commands/return.js ***!
- \****************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "createFloatingCommand": () => (/* binding */ createFloatingCommand),
- /* harmony export */ "renderCommand": () => (/* binding */ renderCommand)
- /* harmony export */ });
- /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
- /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
- /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
- /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
- /* harmony import */ var _generic_expression__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./generic_expression */ "./js/visualUI/commands/generic_expression.js");
- /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
- /* harmony import */ var _code_generator__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../code_generator */ "./js/visualUI/code_generator.js");
- function createFloatingCommand() {
- 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>');
- }
- function renderCommand(command, function_obj) {
- 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>');
- el.data('command', command);
- if (function_obj.return_type != _types__WEBPACK_IMPORTED_MODULE_0__.Types.VOID) {
- if (!command.variable_value_menu) {
- 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)];
- }
- _generic_expression__WEBPACK_IMPORTED_MODULE_4__.renderExpression(command, function_obj, el.find('.expression_elements'), command.variable_value_menu);
- el.append($('<i class="ui icon unlock button_alternate_expression" style="margin-left: 1rem;"></i>'));
- if (command.lockexpression) {
- if (command.variable_value_menu) {
- try {
- var text = _code_generator__WEBPACK_IMPORTED_MODULE_6__.elementExpressionCode(command.variable_value_menu);
- if (text) {
- $(el.find('.expression_elements')[0]).toggle();
- $(el.find('.textual_expression')[0]).text(text);
- $(el.find('.textual_expression')[0]).toggle();
- $(el.find('.button_alternate_expression')[0]).toggleClass('unlock').toggleClass('lock');
- }
- } catch (e) {
- command.lockexpression = false;
- }
- }
- }
- } else {
- el.find('.expression_elements').remove();
- command.variable_value_menu = null;
- }
- addHandlers(command, function_obj, el);
- return el;
- }
- function addHandlers(command, function_obj, return_dom) {
- return_dom.find('.button_alternate_expression').on('click', function () {
- if (command.variable_value_menu) {
- var text = _code_generator__WEBPACK_IMPORTED_MODULE_6__.elementExpressionCode(command.variable_value_menu);
- if (text) {
- $(return_dom.find('.expression_elements')[0]).toggle();
- $(return_dom.find('.textual_expression')[0]).text(text);
- $(return_dom.find('.textual_expression')[0]).toggle();
- $(this).toggleClass('unlock').toggleClass('lock');
- command.lockexpression = !command.lockexpression;
- }
- }
- });
- return_dom.find('.button_remove_command').on('click', function () {
- if (_commands__WEBPACK_IMPORTED_MODULE_3__.removeCommand(command, function_obj, return_dom)) {
- return_dom.fadeOut(400, function () {
- return_dom.remove();
- });
- }
- });
- }
- /***/ }),
- /***/ "./js/visualUI/commands/switch.js":
- /*!****************************************!*\
- !*** ./js/visualUI/commands/switch.js ***!
- \****************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "createFloatingCommand": () => (/* binding */ createFloatingCommand),
- /* harmony export */ "renderCommand": () => (/* binding */ renderCommand),
- /* harmony export */ "renderCase": () => (/* binding */ renderCase)
- /* harmony export */ });
- /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
- /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
- /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
- /* harmony import */ var _contextualized_menu__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
- function createFloatingCommand() {
- 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>');
- }
- function renderCommand(command, function_obj) {
- var ret = '';
- 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>';
- ret += '</div>';
- var el = $(ret);
- el.data('command', command);
- addHandlers(command, function_obj, el);
- _contextualized_menu__WEBPACK_IMPORTED_MODULE_3__.renderMenu(command, el.find('.context_menu'), function_obj, el);
- _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, command.variable, el.find('.variable_to_switch'), function_obj);
- if (command.cases) {
- for (var i = 0; i < command.cases.length; i++) {
- renderCase(command.cases[i], command, function_obj, el.find('.all_cases_div'));
- }
- }
- return el;
- }
- function renderCase(switchcase, command, function_obj, el) {
- 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>');
- _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, switchcase.variable_value_menu, casediv.find('.variable_case'), function_obj);
- casediv.data('switchcase', switchcase);
- casediv.find('.case_commands_block').data('switchcase', switchcase);
- el.append(casediv);
- if (switchcase.commands_block) {
- for (var j = 0; j < switchcase.commands_block.length; j++) {
- _commands__WEBPACK_IMPORTED_MODULE_1__.renderCommand(switchcase.commands_block[j], $(casediv.find('.case_commands_block')[0]), 3, function_obj);
- }
- }
- casediv.find('.button_remove_command').on('click', function () {
- for (var i = 0; i < command.cases.length; i++) {
- if (switchcase == command.cases[i]) {
- delete command.cases[i];
- command.cases.splice(i, 1);
- casediv.remove();
- break;
- }
- }
- });
- }
- function addHandlers(command, function_obj, switch_dom) {
- switch_dom.find('.button_remove_command').on('click', function () {
- if (_commands__WEBPACK_IMPORTED_MODULE_1__.removeCommand(command, function_obj, switch_dom)) {
- switch_dom.fadeOut(400, function () {
- switch_dom.remove();
- });
- }
- });
- }
- /***/ }),
- /***/ "./js/visualUI/commands/variable_value_menu.js":
- /*!*****************************************************!*\
- !*** ./js/visualUI/commands/variable_value_menu.js ***!
- \*****************************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "VAR_OR_VALUE_TYPES": () => (/* binding */ VAR_OR_VALUE_TYPES),
- /* harmony export */ "renderMenu": () => (/* binding */ renderMenu)
- /* harmony export */ });
- /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
- /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
- /* harmony import */ var _attribution__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./attribution */ "./js/visualUI/commands/attribution.js");
- /* harmony import */ var _repeatNtimes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
- var VAR_OR_VALUE_TYPES = Object.freeze({
- only_variable: 1,
- only_value: 2,
- only_function: 3,
- variable_and_function: 4,
- variable_and_value_opt: 5,
- value_and_function: 6,
- all: 7
- });
- function renderMenu(command, ref_object, dom_object, function_obj) {
- var size_field = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 2;
- var expression_element = arguments.length > 5 ? arguments[5] : undefined;
- // Verificar se o objeto atual trata-se de uma chamada de função e conferir se possui a quantidade correta de parâmetros
- // Caso não possua, tem que adicionar as variáveis que servirão de parâmetros:
- if (ref_object.function_called) {
- if (ref_object.function_called.parameters_list) {
- while (ref_object.function_called.parameters_list.length != ref_object.parameters_list.length) {
- if (ref_object.parameters_list.length > ref_object.function_called.parameters_list.length) {
- ref_object.parameters_list.pop();
- } else {
- ref_object.parameters_list.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true));
- }
- }
- }
- } // Verificar agora, quando trata-se de chamada de função, se a passagem de parâmetro é
- // por referência ou por cópia:
- var index_references = [];
- if (ref_object.function_called) {
- if (ref_object.function_called.parameters_list) {
- for (var i = 0; i < ref_object.function_called.parameters_list.length; i++) {
- if (ref_object.function_called.parameters_list[i].reference) {
- index_references.push(i);
- ref_object.parameters_list[i].reference = true;
- ref_object.parameters_list[i].variable_and_value = VAR_OR_VALUE_TYPES.only_variable;
- if (ref_object.parameters_list[i].column) ref_object.parameters_list[i].column.reference_parent = true;
- if (ref_object.parameters_list[i].row) ref_object.parameters_list[i].row.reference_parent = true;
- } else {
- ref_object.parameters_list[i].reference = false;
- ref_object.parameters_list[i].variable_and_value = VAR_OR_VALUE_TYPES.all;
- if (ref_object.parameters_list[i].column) ref_object.parameters_list[i].column.reference_parent = false;
- if (ref_object.parameters_list[i].row) ref_object.parameters_list[i].row.reference_parent = false;
- }
- ref_object.parameters_list[i].reference_dimensions = ref_object.function_called.parameters_list[i].dimensions;
- }
- }
- }
- 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">';
- if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_variable) {
- 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">';
- menu_var_or_value += "</div>";
- }
- 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) {
- 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");
- menu_var_or_value += '<div class="menu menu_only_vars">';
- menu_var_or_value += "</div></div>";
- }
- if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_value) {
- menu_var_or_value = '<input type="text" class="width-dynamic" size="' + size_field + '" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />';
- }
- 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) {
- 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>";
- }
- if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_function) {
- 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">';
- menu_var_or_value += "</div>";
- }
- 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) {
- 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");
- menu_var_or_value += '<div class="menu menu_only_functions">';
- menu_var_or_value += "</div></div>";
- /* if (command.type == Models.COMMAND_TYPES.attribution) {
- menu_var_or_value += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
- menu_var_or_value += '<div class="menu">';
- menu_var_or_value += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
- menu_var_or_value += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
- menu_var_or_value += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
- menu_var_or_value += '</div></div>';
- }*/
- }
- menu_var_or_value += "</div></div>";
- menu_var_or_value = $(menu_var_or_value);
- menu_var_or_value.find('.width-dynamic').on('input', function () {
- var input_field = $(this);
- var inputWidth = input_field.textWidth() + 10;
- inputWidth = inputWidth < 50 ? 50 : inputWidth;
- input_field.css({
- width: inputWidth
- });
- }).trigger('input');
- dom_object.append(menu_var_or_value);
- ref_object.dom_object = menu_var_or_value;
- addHandlers(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
- addVariablesToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
- addFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
- addIVProgFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
- if (ref_object.content || ref_object.function_called) {
- if (ref_object.content) {
- // Verificar se a variável ainda existe:
- var variable_fun = isVarInProgram(ref_object.content, function_obj);
- if (variable_fun) {
- ref_object.content = variable_fun;
- renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
- } else {
- if (ref_object.content && ref_object.content.type) {
- ref_object.content = null;
- appendSelectText(ref_object, menu_var_or_value);
- } else {
- renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
- }
- }
- } else if (ref_object.function_called) {
- // Verificar se a função ainda existe:
- var ret_function = isFunctionInProgram(ref_object.function_called);
- if (ret_function) {
- ref_object.function_called = ret_function;
- renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
- } else {
- ref_object.content = null;
- ref_object.row = null;
- ref_object.column = null;
- delete ref_object.function_called;
- delete ref_object.parameters_list;
- appendSelectText(ref_object, menu_var_or_value);
- }
- }
- } else {
- appendSelectText(ref_object, menu_var_or_value);
- }
- }
- function appendSelectText(ref_object, menu_var_or_value) {
- // if (ref_object.reference_parent) {
- // menu_var_or_value
- // .find(".text")
- // .append("<i>Opcional</i>");
- // return;
- // }
- switch (ref_object.variable_and_value) {
- case VAR_OR_VALUE_TYPES.only_variable:
- menu_var_or_value.find(".text").append("<i>" + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("var_menu_select_var") + "</i>");
- break;
- case VAR_OR_VALUE_TYPES.all:
- menu_var_or_value.find(".text").append("<i>" + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("var_menu_select_all") + "</i>");
- break;
- case VAR_OR_VALUE_TYPES.variable_and_function:
- menu_var_or_value.find(".text").append("<i>" + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("var_menu_select_all") + "</i>");
- break;
- case VAR_OR_VALUE_TYPES.only_function:
- menu_var_or_value.find(".text").append("<i>" + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("var_menu_select_function") + "</i>");
- break;
- }
- }
- function isFunctionInProgram(function_called_obj) {
- if (function_called_obj.name) {
- if (window.program_obj.functions) {
- for (var i = 0; i < window.program_obj.functions.length; i++) {
- if (window.program_obj.functions[i] == function_called_obj) {
- return window.program_obj.functions[i];
- }
- }
- for (var i = 0; i < window.program_obj.functions.length; i++) {
- if (window.program_obj.functions[i].name == function_called_obj.name) {
- return window.program_obj.functions[i];
- }
- }
- }
- } else if (function_called_obj.identifier) {
- for (var i = 0; i < window.system_functions.length; i++) {
- if (window.system_functions[i].identifier == function_called_obj.identifier) {
- return window.system_functions[i];
- }
- }
- }
- return null;
- }
- function isVarInProgram(var_obj, function_obj) {
- // Verify in locals:
- if (function_obj.variables_list) {
- for (var i = 0; i < function_obj.variables_list.length; i++) {
- if (function_obj.variables_list[i] == var_obj) {
- return function_obj.variables_list[i];
- }
- }
- } // Verify in parameters:
- if (function_obj.parameters_list) {
- for (var i = 0; i < function_obj.parameters_list.length; i++) {
- if (function_obj.parameters_list[i] == var_obj) {
- return function_obj.parameters_list[i];
- }
- }
- } // Verify in globals:
- if (window.program_obj.globals) {
- for (var i = 0; i < window.program_obj.globals.length; i++) {
- if (window.program_obj.globals[i] == var_obj) {
- return window.program_obj.globals[i];
- }
- }
- } // If not found, verify if the reference was lost
- if (var_obj) {
- if (function_obj.variables_list) {
- for (var i = 0; i < function_obj.variables_list.length; i++) {
- if (function_obj.variables_list[i].name == var_obj.name) {
- return function_obj.variables_list[i];
- }
- }
- }
- if (function_obj.parameters_list) {
- for (var i = 0; i < function_obj.parameters_list.length; i++) {
- if (function_obj.parameters_list[i].name == var_obj.name) {
- return function_obj.parameters_list[i];
- }
- }
- }
- if (window.program_obj.globals) {
- for (var i = 0; i < window.program_obj.globals.length; i++) {
- if (window.program_obj.globals[i].name == var_obj.name) {
- return window.program_obj.globals[i];
- }
- }
- }
- }
- return null;
- }
- function renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element) {
- if (ref_object.function_called) {
- menu_var_or_value.remove();
- variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
- } else if (ref_object.content.type) {
- menu_var_or_value.remove();
- variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
- } else {
- menu_var_or_value.remove();
- variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
- }
- }
- function variableValueMenuCode(command, variable_obj, dom_object, function_obj, menu_var_or_value, expression_element) {
- if (variable_obj.content || variable_obj.function_called) {
- // Verificar se a variável ainda existe:
- var var_fun = isVarInProgram(variable_obj.content, function_obj);
- if (var_fun) {
- variable_obj.content = var_fun;
- } else {
- if (variable_obj.content && variable_obj.content.type) {
- variable_obj.content = null;
- appendSelectText(variable_obj, menu_var_or_value);
- }
- }
- } else {
- appendSelectText(variable_obj, menu_var_or_value);
- }
- if (variable_obj.content == null && variable_obj.function_called == null) {
- renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
- return;
- }
- var ret = "";
- if (variable_obj.function_called) {
- if (variable_obj.function_called.parameters_list == null || variable_obj.function_called.length == 0) {
- menu_var_or_value.find(".text").text(" ");
- dom_object.find(".menu_var_or_value_dom").remove();
- var parameters_menu;
- if (variable_obj.function_called.name) {
- parameters_menu = '<div class="parameters_function_called"> ' + variable_obj.function_called.name + " <span> ( </span>";
- } else {
- 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>";
- }
- parameters_menu += "<span> ) </span></div>";
- parameters_menu = $(parameters_menu);
- dom_object.append(parameters_menu);
- var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
- context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("btn_clear") + "</div>";
- /*if (command.type == Models.COMMAND_TYPES.attribution) {
- context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
- context_menu += '<div class="menu">';
- context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
- context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
- context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
- context_menu += '</div></div>';
- }*/
- context_menu += "</div></div>";
- context_menu = $(context_menu);
- context_menu.insertAfter(dom_object.find(".parameters_function_called"));
- context_menu.dropdown({
- onChange: function onChange(value, text, $selectedItem) {
- if ($selectedItem.data("clear")) {
- dom_object.text("");
- variable_obj.content = null;
- variable_obj.row = null;
- variable_obj.column = null;
- delete variable_obj.function_called;
- delete variable_obj.parameters_list;
- renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
- }
- if ($selectedItem.data("exp")) {
- _attribution__WEBPACK_IMPORTED_MODULE_2__.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
- }
- },
- selectOnKeydown: false
- });
- } else {
- menu_var_or_value.find(".text").text(" ");
- dom_object.find(".menu_var_or_value_dom").remove();
- var parameters_menu;
- if (variable_obj.function_called.name) {
- parameters_menu = '<div class="parameters_function_called"> ' + variable_obj.function_called.name + " <span> ( </span>";
- } else {
- 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>";
- }
- for (var j = 0; j < variable_obj.function_called.parameters_list.length; j++) {
- parameters_menu += '<div class="render_style_param parameter_' + j + '"></div>';
- if (j + 1 != variable_obj.function_called.parameters_list.length) {
- parameters_menu += " , ";
- }
- }
- parameters_menu += "<span> ) </span></div>";
- parameters_menu = $(parameters_menu);
- dom_object.append(parameters_menu);
- for (var _j = 0; _j < variable_obj.function_called.parameters_list.length; _j++) {
- renderMenu(command, variable_obj.parameters_list[_j], parameters_menu.find(".parameter_" + _j), function_obj, 2, expression_element);
- }
- var _context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
- _context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("btn_clear") + "</div>";
- /*if (command.type == Models.COMMAND_TYPES.attribution) {
- context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
- context_menu += '<div class="menu">';
- context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
- context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
- context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
- context_menu += '</div></div>';
- }*/
- _context_menu += "</div></div>";
- _context_menu = $(_context_menu);
- _context_menu.insertAfter(parameters_menu);
- _context_menu.dropdown({
- onChange: function onChange(value, text, $selectedItem) {
- if ($selectedItem.data("clear")) {
- dom_object.text("");
- variable_obj.content = null;
- variable_obj.row = null;
- variable_obj.column = null;
- delete variable_obj.function_called;
- delete variable_obj.parameters_list;
- renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
- }
- if ($selectedItem.data("exp")) {
- _attribution__WEBPACK_IMPORTED_MODULE_2__.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
- }
- },
- selectOnKeydown: false
- });
- }
- } else if (variable_obj.content.type) {
- var variable_render = "";
- if (variable_obj.content.dimensions == 1 && variable_obj.dimensions != 1) {
- variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + "</span>";
- if (variable_obj.reference_dimensions >= 1) variable_render += '';else variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
- variable_render += "</div>";
- variable_render = $(variable_render);
- dom_object.append(variable_render);
- var _context_menu2 = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
- _context_menu2 += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("btn_clear") + "</div>";
- /*if (command.type == Models.COMMAND_TYPES.attribution) {
- context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
- context_menu += '<div class="menu">';
- context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
- context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
- context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
- context_menu += '</div></div>';
- }*/
- _context_menu2 += "</div></div>";
- _context_menu2 = $(_context_menu2);
- variable_render.append(_context_menu2);
- _context_menu2.dropdown({
- onChange: function onChange(value, text, $selectedItem) {
- if ($selectedItem.data("clear")) {
- dom_object.text("");
- variable_obj.content = null;
- variable_obj.row = null;
- variable_obj.column = null;
- delete variable_obj.function_called;
- delete variable_obj.parameters_list;
- renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
- }
- if ($selectedItem.data("exp")) {
- _attribution__WEBPACK_IMPORTED_MODULE_2__.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
- }
- },
- selectOnKeydown: false
- });
- if (!variable_obj.column) {
- var temp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
- if (variable_obj.reference) temp.reference_parent = true;
- variable_obj.column = temp;
- }
- variableValueMenuCode(command, variable_obj.column, $(variable_render.find(".column_container")), function_obj, menu_var_or_value, expression_element);
- } else if (variable_obj.content.dimensions == 2 && variable_obj.dimensions != 2) {
- variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + "</span>";
- variable_render += ' <span>[ </span> <div class="row_container"></div> <span> ]</span>';
- if (variable_obj.reference_dimensions == 0) variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ] </span>';
- variable_render += "</div>";
- variable_render = $(variable_render);
- dom_object.append(variable_render);
- var _context_menu3 = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
- _context_menu3 += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("btn_clear") + "</div>";
- /*if (command.type == Models.COMMAND_TYPES.attribution) {
- context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
- context_menu += '<div class="menu">';
- context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
- context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
- context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
- context_menu += '</div></div>';
- }*/
- _context_menu3 += "</div></div>";
- _context_menu3 = $(_context_menu3);
- variable_render.append(_context_menu3);
- _context_menu3.dropdown({
- onChange: function onChange(value, text, $selectedItem) {
- if ($selectedItem.data("clear")) {
- dom_object.text("");
- variable_obj.content = null;
- variable_obj.row = null;
- variable_obj.column = null;
- delete variable_obj.function_called;
- delete variable_obj.parameters_list;
- renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
- }
- if ($selectedItem.data("exp")) {
- _attribution__WEBPACK_IMPORTED_MODULE_2__.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
- }
- },
- selectOnKeydown: false
- });
- if (!variable_obj.column) {
- var temp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
- if (variable_obj.reference) temp.reference_parent = true;
- variable_obj.column = temp;
- }
- if (!variable_obj.row) {
- var temp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
- if (variable_obj.reference) temp.reference_parent = true;
- variable_obj.row = temp;
- }
- variableValueMenuCode(command, variable_obj.row, $(variable_render.find(".row_container")), function_obj, menu_var_or_value, expression_element);
- if (variable_obj.reference_dimensions == 1) {
- variable_obj.column = null;
- } else {
- variableValueMenuCode(command, variable_obj.column, $(variable_render.find(".column_container")), function_obj, menu_var_or_value, expression_element);
- }
- } else {
- variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + "</span>";
- variable_render += "</div>";
- variable_render = $(variable_render);
- dom_object.append(variable_render);
- var _context_menu4 = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
- _context_menu4 += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("btn_clear") + "</div>";
- /*if (command.type == Models.COMMAND_TYPES.attribution && !dom_object.hasClass('var_attributed')) {
- console.log('dom_object6');
- console.log(dom_object);
- context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
- context_menu += '<div class="menu">';
- context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
- context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
- context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
- context_menu += '</div></div>';
- }*/
- _context_menu4 += "</div></div>";
- _context_menu4 = $(_context_menu4);
- variable_render.append(_context_menu4);
- _context_menu4.dropdown({
- onChange: function onChange(value, text, $selectedItem) {
- if ($selectedItem.data("clear")) {
- dom_object.text("");
- variable_obj.content = null;
- variable_obj.row = null;
- variable_obj.column = null;
- delete variable_obj.function_called;
- delete variable_obj.parameters_list;
- renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
- }
- if ($selectedItem.data("exp")) {
- _attribution__WEBPACK_IMPORTED_MODULE_2__.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
- }
- },
- selectOnKeydown: false
- });
- }
- } else {
- var _variable_render;
- _variable_render = '<div class="variable_rendered"> <span class="var_name">';
- if (isNaN(variable_obj.content)) {
- _variable_render += variable_obj.content.split(" ").join(" ");
- } else {
- _variable_render += variable_obj.content;
- }
- _variable_render += "</span>";
- _variable_render += "</div>";
- _variable_render = $(_variable_render);
- dom_object.append(_variable_render);
- var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
- context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("btn_clear") + "</div>";
- /*if (command.type == Models.COMMAND_TYPES.attribution) {
- context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
- context_menu += '<div class="menu">';
- context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
- context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
- context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
- context_menu += '</div></div>';
- }*/
- context_menu += "</div></div>";
- context_menu = $(context_menu);
- if (variable_obj.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
- context_menu.insertAfter(_variable_render);
- }
- context_menu.dropdown({
- onChange: function onChange(value, text, $selectedItem) {
- if ($selectedItem.data("clear")) {
- dom_object.text("");
- variable_obj.content = null;
- variable_obj.row = null;
- variable_obj.column = null;
- delete variable_obj.function_called;
- delete variable_obj.parameters_list;
- dom_object.find(".value_rendered").remove();
- dom_object.find(".context_menu_clear").remove();
- dom_object.find(".width-dynamic-minus").remove();
- renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
- }
- if ($selectedItem.data("exp")) {
- _attribution__WEBPACK_IMPORTED_MODULE_2__.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
- }
- },
- selectOnKeydown: false
- });
- _variable_render.on("click", function (e) {
- _variable_render.remove();
- _variable_render.empty();
- _variable_render.remove();
- dom_object.empty();
- dom_object.append('<span class="menu_var_or_value_dom"> </span>');
- openInputToValue(command, variable_obj, dom_object, menu_var_or_value, function_obj, expression_element);
- });
- }
- }
- function addIVProgFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
- var sub_menu = menu_var_or_value.find(".menu_only_functions");
- sub_menu.append('<div class="divider"></div><div class="header">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_header_ivprog_functions") + "</div>");
- 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>');
- 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>');
- 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>');
- 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:
- for (var i = 0; i < window.system_functions.length; i++) {
- var t = $('<div class="item"></div>');
- t.data("function_reference", window.system_functions[i]);
- t.data("option", VAR_OR_VALUE_TYPES.only_function);
- t.text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.translateInternalFunction(window.system_functions[i].identifier));
- switch (window.system_functions[i].category) {
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.SYSTEM_FUNCTIONS_CATEGORIES.math:
- sub_menu.find(".menu_math_functions").append(t);
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.SYSTEM_FUNCTIONS_CATEGORIES.text:
- sub_menu.find(".menu_text_functions").append(t);
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.SYSTEM_FUNCTIONS_CATEGORIES.arrangement:
- sub_menu.find(".menu_arrangement_functions").append(t);
- break;
- case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.SYSTEM_FUNCTIONS_CATEGORIES.conversion:
- sub_menu.find(".menu_conversion_functions").append(t);
- break;
- }
- }
- }
- function addFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
- var sub_menu = menu_var_or_value.find(".menu_only_functions");
- sub_menu.text("");
- for (var i = 0; i < window.program_obj.functions.length; i++) {
- var temp = $('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_function + '">' + window.program_obj.functions[i].name + " </div>");
- temp.data("function_reference", window.program_obj.functions[i]);
- sub_menu.append(temp);
- }
- }
- function addVariablesToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
- var sub_menu = menu_var_or_value.find(".menu_only_vars");
- sub_menu.text("");
- var is_there = false;
- if (window.program_obj.globals) {
- if (ref_object.include_constant) {
- for (var i = 0; i < window.program_obj.globals.length; i++) {
- var temp = $('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + window.program_obj.globals[i].name + " </div>");
- temp.data("variable_reference", window.program_obj.globals[i]);
- sub_menu.append(temp);
- is_there = true;
- }
- } else {
- for (var i = 0; i < window.program_obj.globals.length; i++) {
- if (!window.program_obj.globals[i].is_constant) {
- var temp = $('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + window.program_obj.globals[i].name + " </div>");
- temp.data("variable_reference", window.program_obj.globals[i]);
- sub_menu.append(temp);
- is_there = true;
- }
- }
- }
- }
- if (function_obj.parameters_list) {
- for (var i = 0; i < function_obj.parameters_list.length; i++) {
- var temp = $('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + function_obj.parameters_list[i].name + " </div>");
- temp.data("variable_reference", function_obj.parameters_list[i]);
- sub_menu.append(temp);
- is_there = true;
- }
- }
- if (function_obj.variables_list) {
- for (var i = 0; i < function_obj.variables_list.length; i++) {
- var temp = $('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + function_obj.variables_list[i].name + " </div>");
- temp.data("variable_reference", function_obj.variables_list[i]);
- sub_menu.append(temp);
- is_there = true;
- }
- }
- if (!is_there) {
- sub_menu.append($('<div class="header">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_no_variable") + "</div>"));
- sub_menu.append($('<div class="item disabled">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_no_variable_instruction") + "</div>"));
- }
- }
- function addHandlers(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element) {
- if (ref_object.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
- menu_var_or_value.dropdown({
- onChange: function onChange(value, text, $selectedItem) {
- dom_object.find(".var_name").remove();
- switch ($selectedItem.data("option")) {
- case VAR_OR_VALUE_TYPES.only_function:
- openInputToFunction(command, ref_object, dom_object, menu_var_or_value, function_obj, $($selectedItem).data("function_reference"), expression_element);
- break;
- case VAR_OR_VALUE_TYPES.only_value:
- openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
- break;
- case VAR_OR_VALUE_TYPES.only_variable:
- openInputToVariable(command, ref_object, dom_object, menu_var_or_value, function_obj, $($selectedItem).data("variable_reference"), expression_element);
- break;
- }
- if ($selectedItem.data("exp")) {
- _attribution__WEBPACK_IMPORTED_MODULE_2__.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
- }
- if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.repeatNtimes) {
- _repeatNtimes__WEBPACK_IMPORTED_MODULE_3__.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
- }
- },
- selectOnKeydown: false
- });
- }
- dom_object.find(".width-dynamic").on("input", function () {
- var inputWidth = $(this).textWidth() + 10;
- $(this).focus();
- var tmpStr = $(this).val();
- $(this).val("");
- $(this).val(tmpStr);
- $(this).css({
- width: inputWidth
- });
- }).trigger("input");
- if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.comment) {
- dom_object.parent().on("click", function (e) {
- dom_object.find(".value_rendered").remove();
- dom_object.find(".value_rendered").empty();
- dom_object.find(".value_rendered").remove();
- dom_object.empty();
- dom_object.append('<span class="menu_var_or_value_dom"> </span>');
- openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
- });
- }
- }
- function openInputToFunction(command, ref_object, dom_object, menu_var_or_value, function_obj, function_selected, expression_element) {
- ref_object.function_called = function_selected;
- ref_object.parameters_list = [];
- if (function_selected.parameters_list != null && function_selected.parameters_list.length > 0) {
- menu_var_or_value.find(".text").text(" ");
- dom_object.find(".menu_var_or_value_dom").remove();
- var parameters_menu;
- if (function_selected.name) {
- parameters_menu = '<div class="parameters_function_called"> ' + function_selected.name + " <span> ( </span>";
- } else {
- 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>";
- }
- for (var j = 0; j < function_selected.parameters_list.length; j++) {
- parameters_menu += '<div class="render_style_param parameter_' + j + '"></div>';
- if (j + 1 != function_selected.parameters_list.length) {
- parameters_menu += " , ";
- }
- }
- parameters_menu += "<span> ) </span></div>";
- parameters_menu = $(parameters_menu);
- dom_object.append(parameters_menu);
- for (var j = 0; j < function_selected.parameters_list.length; j++) {
- var temp;
- if (function_selected.parameters_list[j].dimensions > 0) {
- 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);
- } else {
- temp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
- }
- if (function_selected.parameters_list[j].reference == true) {
- temp.reference = true;
- temp.variable_and_value = VAR_OR_VALUE_TYPES.only_variable;
- } else {
- temp.reference = false;
- temp.variable_and_value = VAR_OR_VALUE_TYPES.all;
- }
- temp.reference_dimensions = function_selected.parameters_list[j].dimensions;
- ref_object.parameters_list.push(temp);
- renderMenu(command, temp, parameters_menu.find(".parameter_" + j), function_obj, 2, expression_element);
- }
- var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
- context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("btn_clear") + "</div>";
- /*if (command.type == Models.COMMAND_TYPES.attribution) {
- context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
- context_menu += '<div class="menu">';
- context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
- context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
- context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
- context_menu += '</div></div>';
- }*/
- context_menu += "</div></div>";
- context_menu = $(context_menu);
- context_menu.insertAfter(dom_object.find(".parameters_function_called"));
- context_menu.dropdown({
- onChange: function onChange(value, text, $selectedItem) {
- if ($selectedItem.data("clear")) {
- dom_object.text("");
- ref_object.content = null;
- ref_object.row = null;
- ref_object.column = null;
- delete ref_object.function_called;
- delete ref_object.parameters_list;
- renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
- }
- if ($selectedItem.data("exp")) {
- _attribution__WEBPACK_IMPORTED_MODULE_2__.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
- }
- },
- selectOnKeydown: false
- });
- } else {
- menu_var_or_value.find(".text").text(" ");
- dom_object.find(".menu_var_or_value_dom").remove();
- var parameters_menu;
- if (function_selected.name) {
- parameters_menu = '<div class="parameters_function_called"> ' + function_selected.name + " <span> ( </span>";
- } else {
- 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>";
- }
- parameters_menu += "<span> ) </span></div>";
- parameters_menu = $(parameters_menu);
- dom_object.append(parameters_menu);
- var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
- context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("btn_clear") + "</div>";
- /*if (command.type == Models.COMMAND_TYPES.attribution) {
- context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
- context_menu += '<div class="menu">';
- context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
- context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
- context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
- context_menu += '</div></div>';
- }*/
- context_menu += "</div></div>";
- context_menu = $(context_menu);
- context_menu.insertAfter(dom_object.find(".parameters_function_called"));
- context_menu.dropdown({
- onChange: function onChange(value, text, $selectedItem) {
- if ($selectedItem.data("clear")) {
- dom_object.text("");
- ref_object.content = null;
- ref_object.row = null;
- ref_object.column = null;
- delete ref_object.function_called;
- delete ref_object.parameters_list;
- renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
- }
- if ($selectedItem.data("exp")) {
- _attribution__WEBPACK_IMPORTED_MODULE_2__.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
- }
- },
- selectOnKeydown: false
- });
- }
- /*if (command.type == Models.COMMAND_TYPES.attribution) {
- AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj);
- }*/
- }
- function openInputToVariable(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected, expression_element) {
- ref_object.content = variable_selected;
- menu_var_or_value.find(".text").text(" ");
- dom_object.find(".menu_var_or_value_dom").remove();
- var variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_selected.name + "</span>";
- if (variable_selected.dimensions == 1 && ref_object.dimensions != 1) {
- variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
- }
- if (variable_selected.dimensions == 2 && ref_object.dimensions != 2) {
- variable_render += ' <span>[ </span> <div class="row_container"></div> <span> ]</span> ';
- variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
- }
- variable_render += "</div>";
- variable_render = $(variable_render);
- dom_object.append(variable_render);
- if (variable_selected.dimensions == 1 && ref_object.dimensions != 1) {
- var temp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
- if (ref_object.reference) temp.reference_parent = true;
- ref_object.column = temp;
- renderMenu(command, ref_object.column, variable_render.find(".column_container"), function_obj, 2, expression_element);
- }
- if (variable_selected.dimensions == 2 && ref_object.dimensions != 2) {
- var temp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
- if (ref_object.reference) temp.reference_parent = true;
- ref_object.row = temp;
- renderMenu(command, ref_object.row, variable_render.find(".row_container"), function_obj, 2, expression_element);
- var temp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
- if (ref_object.reference) temp.reference_parent = true;
- ref_object.column = temp;
- renderMenu(command, ref_object.column, variable_render.find(".column_container"), function_obj, 2, expression_element);
- }
- var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
- context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("btn_clear") + "</div>";
- /*if (command.type == Models.COMMAND_TYPES.attribution && !dom_object.hasClass('var_attributed')) {
- console.log("dom_object 10: ");
- console.log(dom_object);
- context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
- context_menu += '<div class="menu">';
- context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
- context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
- context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
- context_menu += '</div></div>';
- }*/
- context_menu += "</div></div>";
- context_menu = $(context_menu);
- context_menu.insertAfter(dom_object.find(".variable_rendered"));
- context_menu.dropdown({
- onChange: function onChange(value, text, $selectedItem) {
- if ($selectedItem.data("clear")) {
- dom_object.text("");
- ref_object.content = null;
- ref_object.row = null;
- ref_object.column = null;
- delete ref_object.function_called;
- delete ref_object.parameters_list;
- renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
- }
- if ($selectedItem.data("exp")) {
- _attribution__WEBPACK_IMPORTED_MODULE_2__.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
- }
- if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.repeatNtimes) {
- _repeatNtimes__WEBPACK_IMPORTED_MODULE_3__.manageClearExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
- }
- },
- selectOnKeydown: false
- });
- /*if (command.type == Models.COMMAND_TYPES.attribution) {
- AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected);
- }*/
- }
- function openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element) {
- if (ref_object.content == null) {
- ref_object.content = "";
- }
- menu_var_or_value.find(".text").text(" ");
- var field = $('<input type="text" size="2" class="width-dynamic-minus" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />');
- field.insertBefore(dom_object.find(".menu_var_or_value_dom"));
- field.on('input', function () {
- var input_field = $(this);
- var inputWidth = input_field.textWidth() + 10;
- inputWidth = inputWidth < 50 ? 50 : inputWidth;
- input_field.css({
- width: inputWidth
- });
- }).trigger('input');
- var rendered = $('<div class="value_rendered"></div>');
- rendered.insertBefore(field);
- field.focus();
- field.val(ref_object.content);
- var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
- context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("btn_clear") + "</div>";
- /*if (command.type == Models.COMMAND_TYPES.attribution) {
- context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
- context_menu += '<div class="menu">';
- context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
- context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
- context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
- context_menu += '</div></div>';
- }*/
- context_menu += "</div></div>";
- context_menu = $(context_menu);
- dom_object.find(".menu_var_or_value_dom").remove();
- if (ref_object.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
- context_menu.insertAfter(field);
- }
- context_menu.dropdown({
- onChange: function onChange(value, text, $selectedItem) {
- if ($selectedItem.data("clear")) {
- dom_object.text("");
- dom_object.find(".value_rendered").remove();
- dom_object.find(".context_menu_clear").remove();
- dom_object.find(".width-dynamic-minus").remove();
- ref_object.content = null;
- ref_object.row = null;
- ref_object.column = null;
- delete ref_object.function_called;
- delete ref_object.parameters_list;
- renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
- }
- if ($selectedItem.data("exp")) {
- _attribution__WEBPACK_IMPORTED_MODULE_2__.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
- }
- },
- selectOnKeydown: false
- });
- dom_object.find(".width-dynamic-minus").focusout(function () {
- /*if (
- $(this)
- .val()
- .trim()
- ) {
- ref_object.content = $(this)
- .val()
- .trim();
- }*/
- ref_object.content = $(this).val();
- if (isNaN(ref_object.content)) {
- rendered.html(ref_object.content.split(" ").join(" "));
- } else {
- rendered.text(ref_object.content);
- }
- $(this).remove();
- });
- dom_object.find(".width-dynamic-minus").on("keydown", function (e) {
- var code = e.keyCode || e.which;
- if (code == 13) {
- /*if (
- $(this)
- .val()
- .trim()
- ) {
- ref_object.content = $(this)
- .val()
- .trim();
- }*/
- ref_object.content = $(this).val();
- if (isNaN(ref_object.content)) {
- rendered.html(ref_object.content.split(" ").join(" "));
- } else {
- rendered.text(ref_object.content);
- }
- $(this).remove();
- }
- if (code == 27) {
- if (isNaN(ref_object.content)) {
- rendered.html(ref_object.content.split(" ").join(" "));
- } else {
- rendered.text(ref_object.content);
- }
- $(this).remove();
- }
- });
- if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.comment) {
- /*rendered.parent().on('click', function(e) {
- rendered.parent().off();
- console.log("TTT14");
- rendered.remove();
- rendered.empty();
- rendered.remove();
- dom_object.empty();
- dom_object.append('<span class="menu_var_or_value_dom"> </span>');
- openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element)
- });*/
- }
- rendered.on("click", function (e) {
- rendered.empty();
- rendered.remove();
- dom_object.empty();
- dom_object.append('<span class="menu_var_or_value_dom"> </span>');
- openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
- });
- /*if (command.type == Models.COMMAND_TYPES.attribution) {
- AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj);
- }*/
- }
- $.fn.textWidth = function (text, font) {
- if (!$.fn.textWidth.fakeEl) $.fn.textWidth.fakeEl = $("<span>").hide().appendTo(document.body);
- $.fn.textWidth.fakeEl.text(text || this.val() || this.text() || this.attr("placeholder")).css("font", font || this.css("font"));
- return $.fn.textWidth.fakeEl.width();
- };
- /***/ }),
- /***/ "./js/visualUI/commands/whiletrue.js":
- /*!*******************************************!*\
- !*** ./js/visualUI/commands/whiletrue.js ***!
- \*******************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "createFloatingCommand": () => (/* binding */ createFloatingCommand),
- /* harmony export */ "renderCommand": () => (/* binding */ renderCommand)
- /* harmony export */ });
- /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
- /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
- /* harmony import */ var _conditional_expression__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
- /* harmony import */ var _contextualized_menu__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
- /* harmony import */ var _generic_expression__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./generic_expression */ "./js/visualUI/commands/generic_expression.js");
- /* harmony import */ var _code_generator__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../code_generator */ "./js/visualUI/code_generator.js");
- function createFloatingCommand() {
- 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>');
- }
- function renderCommand(command, function_obj) {
- var ret = '';
- 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>';
- ret += '<span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="textual_expression"></span> <span class="span_command_spec"> ) </span>';
- ret += ' </span>';
- 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>';
- ret += '<div class="ui block_commands">';
- ret += '</div>';
- ret += '<span> </span>';
- ret += '</div>';
- var el = $(ret);
- el.data('command', command);
- el.find('.block_commands').data('command', command);
- addHandlers(command, function_obj, el);
- _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'));
- _generic_expression__WEBPACK_IMPORTED_MODULE_4__.renderExpression(command, function_obj, el.find('.conditional_expression'), command.expression);
- if (command.commands_block) {
- for (var j = 0; j < command.commands_block.length; j++) {
- _commands__WEBPACK_IMPORTED_MODULE_1__.renderCommand(command.commands_block[j], $(el.find('.block_commands')[0]), 3, function_obj);
- }
- }
- if (command.lockexpression) {
- if (command.expression) {
- try {
- var text = _code_generator__WEBPACK_IMPORTED_MODULE_5__.elementExpressionCode(command.expression);
- if (text) {
- $(el.find('.conditional_expression')[0]).toggle();
- $(el.find('.textual_expression')[0]).text(text);
- $(el.find('.textual_expression')[0]).toggle();
- $(el.find('.button_alternate_expression')[0]).toggleClass('unlock').toggleClass('lock');
- }
- } catch (e) {
- command.lockexpression = false;
- }
- }
- }
- el.find('.unlock').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_lock_expression"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- el.find('.lock').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_unlock_expression"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- el.find('.button_write_expression').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_edit_expression"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- return el;
- }
- function addHandlers(command, function_obj, whiletrue_dom) {
- whiletrue_dom.find('.button_write_expression').on('click', function () {
- window.expressionEdition = true;
- window.inputExpression = null;
- var afterWhichElement;
- var lockButton = $(whiletrue_dom.find('.button_alternate_expression')[0]);
- var editButton = $(this);
- afterWhichElement = $(whiletrue_dom.find('.conditional_expression')[0]);
- if (command.lockexpression) {
- afterWhichElement = $(whiletrue_dom.find('.textual_expression')[0]);
- }
- var text = "";
- if (command.expression) {
- if (command.expression.length == 1 && command.expression[0].content == null && !command.expression[0].function_called) {
- text = "";
- } else {
- try {
- text = _code_generator__WEBPACK_IMPORTED_MODULE_5__.elementExpressionCode(command.expression);
- } catch (ex) {
- text = "";
- }
- }
- }
- var ok_button = $('<i class="ui icon check circle expression-edit-confirm"></i>');
- var cancel_button = $('<i class="ui icon undo expression-edit-cancel"></i>');
- var input = $('<input type="text" spellcheck="false" autocomplete="off" class="input-expression-field" >');
- input.val(text);
- input.focusout(function (evt) {
- console.log('focosout event!');
- ok_button.click();
- evt.preventDefault();
- return true;
- });
- input.keyup(function (evt) {
- if (evt.keyCode == 27) {
- // esc
- cancel_button.click();
- }
- if (evt.keyCode == 13) {
- // enter
- ok_button.click();
- }
- });
- ok_button.click(function () {
- var parsed = null;
- parsed = _generic_expression__WEBPACK_IMPORTED_MODULE_4__.expressionParserToVisual(input.val(), function_obj, input);
- if (parsed) {
- window.expressionEdition = false;
- command.expression = parsed;
- renderAlgorithm();
- }
- });
- cancel_button.mousedown(function (evt) {
- var parsed = _generic_expression__WEBPACK_IMPORTED_MODULE_4__.expressionParserToVisual(text, function_obj, input);
- if (parsed) {
- window.expressionEdition = false;
- command.expression = parsed;
- renderAlgorithm();
- }
- });
- input.insertAfter(afterWhichElement);
- input.focus();
- cancel_button.insertAfter(input);
- ok_button.insertAfter(input);
- var len = text.length;
- input[0].setSelectionRange(len, len);
- afterWhichElement.css('display', 'none');
- lockButton.css('display', 'none');
- editButton.css('display', 'none');
- ok_button.popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_edit_expression_confirm"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- cancel_button.popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_edit_expression_cancel"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- });
- whiletrue_dom.find('.minimize_block_button').on('click', function (evt) {
- whiletrue_dom.children('.ui.block_commands').toggle();
- command.collapsed = !command.collapsed;
- });
- $(whiletrue_dom.find('.textual_expression')[0]).toggle();
- whiletrue_dom.find('.button_alternate_expression').on('click', function () {
- if (command.expression) {
- var text = _code_generator__WEBPACK_IMPORTED_MODULE_5__.elementExpressionCode(command.expression);
- if (text) {
- $(whiletrue_dom.find('.conditional_expression')[0]).toggle();
- $(whiletrue_dom.find('.textual_expression')[0]).text(text);
- $(whiletrue_dom.find('.textual_expression')[0]).toggle();
- $(this).toggleClass('unlock').toggleClass('lock');
- command.lockexpression = !command.lockexpression;
- }
- }
- if (command.lockexpression) {
- whiletrue_dom.find('.lock').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_unlock_expression"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- } else {
- whiletrue_dom.find('.unlock').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_lock_expression"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- }
- });
- whiletrue_dom.find('.button_remove_command').on('click', function () {
- if (_commands__WEBPACK_IMPORTED_MODULE_1__.removeCommand(command, function_obj, whiletrue_dom)) {
- whiletrue_dom.fadeOut(400, function () {
- whiletrue_dom.remove();
- });
- }
- });
- }
- /***/ }),
- /***/ "./js/visualUI/commands/writer.js":
- /*!****************************************!*\
- !*** ./js/visualUI/commands/writer.js ***!
- \****************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "createFloatingCommand": () => (/* binding */ createFloatingCommand),
- /* harmony export */ "renderCommand": () => (/* binding */ renderCommand),
- /* harmony export */ "addContent": () => (/* binding */ addContent)
- /* harmony export */ });
- /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
- /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
- /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
- /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
- /* harmony import */ var _generic_expression__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./generic_expression */ "./js/visualUI/commands/generic_expression.js");
- /* harmony import */ var _code_generator__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../code_generator */ "./js/visualUI/code_generator.js");
- function createFloatingCommand() {
- 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>");
- }
- function renderCommand(command, function_obj) {
- 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>");
- var el = $(ret);
- el.data("command", command); //renderExpression (command, function_obj, div_to_render, expression_array)
- _generic_expression__WEBPACK_IMPORTED_MODULE_4__.renderExpression(command, function_obj, el.find(".all_elements_write"), command.content);
- addHandlers(command, function_obj, el);
- if (command.content && command.lockexpression) {
- try {
- var text = _code_generator__WEBPACK_IMPORTED_MODULE_5__.elementExpressionCode(command.content);
- if (text) {
- $(el.find('.all_elements_write')[0]).toggle();
- $(el.find('.textual_expression')[0]).text(text);
- $(el.find('.textual_expression')[0]).toggle();
- $(el.find('.button_alternate_expression')[0]).toggleClass('unlock').toggleClass('lock');
- }
- } catch (e) {
- command.lockexpression = false;
- }
- }
- el.find('.unlock').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_lock_expression"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- el.find('.lock').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_unlock_expression"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- el.find('.button_write_expression').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_edit_expression"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- return el;
- }
- function addHandlersManager(command, _function_obj, _writer_dom, item_div, content_element) {
- item_div.find(".times").on("click", function () {
- for (var i = 0; i < command.content.length; i++) {
- if (command.content[i] == content_element) {
- delete command.content[i];
- command.content.splice(i, 1);
- item_div.children().off();
- item_div.off();
- item_div.fadeOut();
- if (command.content.length > 0) {
- item_div.next(".icon_add_item_to_writer").fadeOut();
- }
- break;
- }
- }
- });
- }
- function addHandlers(command, function_obj, writer_dom) {
- $(writer_dom.find('.textual_expression')[0]).toggle();
- writer_dom.find('.button_write_expression').on('click', function () {
- window.expressionEdition = true;
- window.inputExpression = null;
- var afterWhichElement;
- var lockButton = $(writer_dom.find('.button_alternate_expression')[0]);
- var editButton = $(this);
- afterWhichElement = writer_dom.find('.all_elements_write');
- if (command.lockexpression) {
- afterWhichElement = writer_dom.find('.textual_expression');
- }
- var text = "";
- if (command.content) {
- if (command.content.length == 1 && command.content[0].content == null && !command.content[0].function_called) {
- text = "";
- } else {
- try {
- text = _code_generator__WEBPACK_IMPORTED_MODULE_5__.elementExpressionCode(command.content);
- } catch (ex) {
- text = "";
- }
- }
- }
- var ok_button = $('<i class="ui icon check circle expression-edit-confirm"></i>');
- var cancel_button = $('<i class="ui icon undo expression-edit-cancel"></i>');
- var input = $('<input type="text" spellcheck="false" autocomplete="off" class="input-expression-field" >');
- input.val(text);
- input.focusout(function (evt) {
- ok_button.click();
- evt.preventDefault();
- return true;
- });
- input.keyup(function (evt) {
- if (evt.keyCode == 27) {
- // esc
- cancel_button.click();
- }
- if (evt.keyCode == 13) {
- // enter
- ok_button.click();
- }
- });
- ok_button.click(function () {
- var parsed = null;
- parsed = _generic_expression__WEBPACK_IMPORTED_MODULE_4__.expressionParserToVisual(input.val(), function_obj, input);
- if (parsed) {
- window.expressionEdition = false;
- command.content = parsed;
- renderAlgorithm();
- }
- });
- cancel_button.mousedown(function (evt) {
- var parsed = _generic_expression__WEBPACK_IMPORTED_MODULE_4__.expressionParserToVisual(text, function_obj, input);
- if (parsed) {
- window.expressionEdition = false;
- command.content = parsed;
- renderAlgorithm();
- }
- });
- input.insertAfter(afterWhichElement);
- input.focus();
- cancel_button.insertAfter(input);
- ok_button.insertAfter(input);
- var len = text.length;
- input[0].setSelectionRange(len, len);
- afterWhichElement.css('display', 'none');
- lockButton.css('display', 'none');
- editButton.css('display', 'none');
- ok_button.popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_edit_expression_confirm"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- cancel_button.popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_edit_expression_cancel"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- });
- writer_dom.find('.button_alternate_expression').on('click', function () {
- if (command.content) {
- var text = _code_generator__WEBPACK_IMPORTED_MODULE_5__.elementExpressionCode(command.content);
- if (text) {
- $(writer_dom.find('.all_elements_write')[0]).toggle();
- $(writer_dom.find('.textual_expression')[0]).text(text);
- $(writer_dom.find('.textual_expression')[0]).toggle();
- $(this).toggleClass('unlock').toggleClass('lock');
- command.lockexpression = !command.lockexpression;
- }
- if (command.lockexpression) {
- writer_dom.find('.lock').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_unlock_expression"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- } else {
- writer_dom.find('.unlock').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_lock_expression"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- }
- }
- });
- writer_dom.find(".button_remove_command").on("click", function () {
- if (_commands__WEBPACK_IMPORTED_MODULE_3__.removeCommand(command, function_obj, writer_dom)) {
- writer_dom.fadeOut(400, function () {
- writer_dom.remove();
- });
- }
- });
- Sortable.create(writer_dom.find(".all_elements_write")[0], {
- handle: ".ellipsis",
- animation: 100,
- ghostClass: "ghost",
- group: "writer_" + Math.floor(Math.random() * 10000000),
- draggable: ".div_parent_handler",
- onEnd: function onEnd(evt) {
- command.content.splice(evt.newIndex, 0, command.content.splice(evt.oldIndex, 1)[0]);
- writer_dom.empty();
- writer_dom.replaceWith(renderCommand(command, function_obj));
- }
- }); // Attach event handles for the newline button
- var newlineBtn = writer_dom.find(".ivprog_newline_btn");
- newlineBtn.on("click", function () {
- var state = this.dataset.state;
- if (state === "on") {
- this.dataset.state = "off";
- command.newline = false;
- this.setAttribute("src", "img/no_new_line.svg");
- } else {
- this.dataset.state = "on";
- command.newline = true;
- this.setAttribute("src", "img/new_line.svg");
- }
- writer_dom.data("command", command);
- setPopup(newlineBtn, command.newline);
- }); // Attach jquery popup
- setPopup(newlineBtn, command.newline);
- }
- function setPopup(element, state) {
- if (element.popup("exists")) {
- element.popup("destroy");
- }
- 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");
- element.popup({
- content: content,
- delay: {
- show: 750,
- hide: 0
- }
- });
- }
- function _addHandlerIconAdd(dom_object, command, function_obj) {
- var insert_after = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
- var after_which = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
- var icon_add_item = $('<i class="ui icon plus square outline icon_add_item_to_writer"></i> ');
- if (!insert_after) {
- dom_object.append(icon_add_item);
- } else {
- icon_add_item.insertAfter(after_which);
- }
- icon_add_item.on("click", function (_event) {
- var div_parent_with_handler = $('<div class="div_parent_handler" style="display:none;"></div>');
- var new_div_item = $('<div class="var_value_menu_div"></div>');
- div_parent_with_handler.append($('<i class="ui icon ellipsis vertical inverted handler"></i>'));
- div_parent_with_handler.append(new_div_item);
- div_parent_with_handler.append($('<i class="white inverted icon times handler"></i>'));
- div_parent_with_handler.insertAfter(icon_add_item);
- 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);
- _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, new_related_menu, new_div_item, function_obj);
- addHandlerIconAdd(dom_object, command, function_obj, true, div_parent_with_handler);
- addHandlersManager(command, function_obj, dom_object, div_parent_with_handler, new_related_menu);
- var pos = 1;
- dom_object.find(".icon_add_item_to_writer").each(function () {
- if ($(this).get(0) === icon_add_item.get(0)) {
- command.content.splice(pos, 0, new_related_menu);
- } else {
- pos++;
- }
- });
- if (command.content.length == 1) {
- icon_add_item.remove();
- }
- div_parent_with_handler.fadeIn();
- });
- }
- function addContent(command, _ref_object, dom_object, _menu_var_or_value, function_obj, _ref_object_content) {
- if (dom_object.hasClass("var_value_menu_div")) {
- var icon_add_item = $('<i class="ui icon plus square outline icon_add_item_to_writer"></i> ');
- icon_add_item.insertAfter(dom_object);
- icon_add_item.on("click", function (_event) {
- var div_parent_with_handler = $('<div class="div_parent_handler"></div>');
- div_parent_with_handler.append($('<i class="ui icon ellipsis vertical inverted handler"></i>'));
- div_parent_with_handler.append(new_div_item);
- div_parent_with_handler.append($('<i class="white inverted icon times handler"></i>'));
- div_parent_with_handler.insertAfter(icon_add_item);
- 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);
- _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, new_related_menu, new_div_item, function_obj);
- addHandlersManager(command, function_obj, dom_object, div_parent_with_handler, new_related_menu);
- command.content.push(new_related_menu);
- if (command.content.length == 1) {
- icon_add_item.remove();
- }
- });
- }
- }
- /***/ }),
- /***/ "./js/visualUI/functions.js":
- /*!**********************************!*\
- !*** ./js/visualUI/functions.js ***!
- \**********************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "renderFunction": () => (/* binding */ renderFunction),
- /* harmony export */ "initVisualUI": () => (/* binding */ initVisualUI),
- /* harmony export */ "setTestCases": () => (/* binding */ setTestCases),
- /* harmony export */ "getTestCases": () => (/* binding */ getTestCases),
- /* harmony export */ "addFunctionChangeListener": () => (/* binding */ addFunctionChangeListener),
- /* harmony export */ "addGlobalChangeListener": () => (/* binding */ addGlobalChangeListener),
- /* harmony export */ "removeGlobalListener": () => (/* binding */ removeGlobalListener),
- /* harmony export */ "removeFunctionListener": () => (/* binding */ removeFunctionListener)
- /* harmony export */ });
- /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
- /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
- /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
- /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
- /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
- /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
- /* harmony import */ var _code_generator__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./code_generator */ "./js/visualUI/code_generator.js");
- /* harmony import */ var _commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
- /* harmony import */ var _io_domConsole__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./../io/domConsole */ "./js/io/domConsole.js");
- /* harmony import */ var _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
- /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
- /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(melanke_watchjs__WEBPACK_IMPORTED_MODULE_10__);
- /* harmony import */ var _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
- /* harmony import */ var _assessment_ivprogAssessment__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../assessment/ivprogAssessment */ "./js/assessment/ivprogAssessment.js");
- /* harmony import */ var _algorithm__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./algorithm */ "./js/visualUI/algorithm.js");
- /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
- /* harmony import */ var _services_userLog__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./../services/userLog */ "./js/services/userLog.js");
- /* harmony import */ var _ima_version_json__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./../../.ima_version.json */ "./.ima_version.json");
- /* harmony import */ var _text_editor__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./text_editor */ "./js/visualUI/text_editor.js");
- /* harmony import */ var _util_utils__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./../util/utils */ "./js/util/utils.js");
- /* harmony import */ var _processor_modes__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../processor/modes */ "./js/processor/modes.ts");
- var counter_new_functions = 0;
- var counter_new_parameters = 0;
- var ivprog_version = _ima_version_json__WEBPACK_IMPORTED_MODULE_16__.version;
- var globalChangeListeners = [];
- var functionsChangeListeners = [];
- var proc = null;
- var domConsole = null;
- var _testCases = [];
- var isRunning = false;
- window.studentGrade = null;
- window.LocalizedStrings = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings;
- var program = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.Program();
- window.system_functions = []; // Adding math functions:
- 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));
- 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));
- 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));
- 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));
- 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));
- 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));
- 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));
- 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));
- 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));
- 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));
- 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));
- 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:
- 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));
- 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));
- 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));
- 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));
- 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:
- 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));
- 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));
- 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:
- 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));
- 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));
- 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));
- 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));
- 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));
- 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));
- 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));
- 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));
- 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');
- 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);
- mainFunction.function_comment = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.Comment(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('text_comment_main'));
- program.addFunction(mainFunction);
- window.program_obj = program;
- window.generator = _code_generator__WEBPACK_IMPORTED_MODULE_6__.generate;
- window.runCodeAssessment = runCodeAssessment;
- window.renderAlgorithm = _algorithm__WEBPACK_IMPORTED_MODULE_13__.renderAlgorithm;
- window.insertContext = false;
- window.watchW = (melanke_watchjs__WEBPACK_IMPORTED_MODULE_10___default());
- melanke_watchjs__WEBPACK_IMPORTED_MODULE_10___default().watch(window.program_obj.globals, function () {
- if (window.insertContext) {
- setTimeout(function () {
- _algorithm__WEBPACK_IMPORTED_MODULE_13__.renderAlgorithm();
- globalChangeListeners.forEach(function (x) {
- return x();
- });
- }, 300);
- window.insertContext = false;
- } else {
- _algorithm__WEBPACK_IMPORTED_MODULE_13__.renderAlgorithm();
- globalChangeListeners.forEach(function (x) {
- return x();
- });
- }
- }, 1);
- melanke_watchjs__WEBPACK_IMPORTED_MODULE_10___default().watch(window.program_obj.functions, function () {
- if (window.insertContext) {
- setTimeout(function () {
- _algorithm__WEBPACK_IMPORTED_MODULE_13__.renderAlgorithm();
- functionsChangeListeners.forEach(function (x) {
- return x();
- });
- }, 300);
- window.insertContext = false;
- } else {
- _algorithm__WEBPACK_IMPORTED_MODULE_13__.renderAlgorithm();
- functionsChangeListeners.forEach(function (x) {
- return x();
- });
- }
- }, 1);
- function addFunctionHandler() {
- if (window.program_obj.functions) {
- var in_use = false;
- do {
- in_use = false;
- var temp_name = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('new_function') + '_' + counter_new_functions;
- window.program_obj.functions.forEach(function (el) {
- if (temp_name == el.name) {
- in_use = true;
- }
- });
- if (in_use) counter_new_functions++;
- } while (in_use);
- }
- 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')));
- program.addFunction(new_function);
- counter_new_functions++;
- window.insertContext = true;
- (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);
- renderFunction(new_function);
- /*newe.css('display', 'none');
- newe.fadeIn();*/
- }
- function addParameter(function_obj, function_container
- /*, is_from_click = false*/
- ) {
- if (function_obj.parameters_list == null) {
- function_obj.parameters_list = [];
- }
- if (function_obj.parameters_list) {
- var in_use = false;
- do {
- in_use = false;
- var temp_name = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('new_parameter') + '_' + counter_new_parameters;
- function_obj.parameters_list.forEach(function (el) {
- if (temp_name == el.name) {
- in_use = true;
- }
- });
- if (in_use) counter_new_parameters++;
- } while (in_use);
- }
- 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);
- function_obj.parameters_list.push(new_parameter);
- counter_new_parameters++;
- (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);
- renderParameter(function_obj, new_parameter, function_container); // if (is_from_click) {
- // newe.css('display', 'none');
- // newe.fadeIn();
- // }
- }
- function updateReturnType(function_obj, new_type) {
- var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
- (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);
- function_obj.return_type = new_type;
- function_obj.return_dimensions = new_dimensions;
- }
- function removeFunction(function_obj) {
- var index = program.functions.indexOf(function_obj);
- if (index > -1) {
- (0,_services_userLog__WEBPACK_IMPORTED_MODULE_15__.registerUserEvent)(function_obj.name, _services_userLog__WEBPACK_IMPORTED_MODULE_15__.ActionTypes.REMOVE_FUNCTION);
- program.functions.splice(index, 1);
- }
- }
- function minimizeFunction(function_obj) {
- function_obj.is_hidden = !function_obj.is_hidden;
- }
- function addHandlers(function_obj, function_container) {
- function_container.find('.ui.dropdown.function_return').dropdown({
- onChange: function onChange(value, text, $selectedItem) {
- if ($selectedItem.data('dimensions')) {
- updateReturnType(function_obj, _types__WEBPACK_IMPORTED_MODULE_0__.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
- } else {
- updateReturnType(function_obj, _types__WEBPACK_IMPORTED_MODULE_0__.Types[$selectedItem.data('type')]);
- }
- },
- selectOnKeydown: false
- });
- function_container.find(".name_function_updated").on('click', function (e) {
- enableNameFunctionUpdate(function_obj, function_container);
- });
- function_container.find(".add_parameter_button").on('click', function (e) {
- window.insertContext = true;
- addParameter(function_obj, function_container, true);
- });
- function_container.find('.menu_commands').dropdown({
- on: 'hover'
- });
- function_container.find('.menu_commands a').on('click', function (evt) {
- if (function_obj.commands == null || function_obj.commands.length == 0) {
- function_obj.commands = [];
- var new_cmd = _commands__WEBPACK_IMPORTED_MODULE_5__.genericCreateCommand($(this).data('command'));
- function_obj.commands.push(new_cmd);
- _commands__WEBPACK_IMPORTED_MODULE_5__.renderCommand(new_cmd, function_container.find('.commands_list_div'), 3, function_obj);
- (0,_services_userLog__WEBPACK_IMPORTED_MODULE_15__.registerUserEvent)(function_obj.name, _services_userLog__WEBPACK_IMPORTED_MODULE_15__.ActionTypes.INSERT_COMMAND, $(this).data('command'), '/', 0);
- } else {
- _commands__WEBPACK_IMPORTED_MODULE_5__.createFloatingCommand(function_obj, function_container, $(this).data('command'), evt);
- }
- });
- function_container.find('.add_var_button_function').on('click', function (e) {
- window.insertContext = true;
- _variables__WEBPACK_IMPORTED_MODULE_4__.addVariable(function_obj, function_container, true);
- });
- function_container.find('.remove_function_button').on('click', function (e) {
- removeFunction(function_obj);
- function_container.fadeOut();
- });
- function_container.find('.minimize_function_button').on('click', function (e) {
- minimizeFunction(function_obj);
- if (function_obj.is_hidden) {
- function_container.find(".add_var_button_function").toggle();
- function_container.find(".inline_add_command").toggle();
- function_container.find(".function_area").slideToggle();
- } else {
- function_container.find(".function_area").slideToggle(function () {
- function_container.find(".add_var_button_function").toggle();
- function_container.find(".inline_add_command").toggle();
- });
- }
- });
- } // Essa função imprime o tipo de retorno da função e cria o menu do tipo 'select' para alteração
- function renderFunctionReturn(function_obj, function_element) {
- var ret = '<div class="ui dropdown function_return">';
- if (function_obj.return_dimensions == 1) {
- 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()));
- ret += ' [ ] </div>';
- } else if (function_obj.return_dimensions == 2) {
- 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()));
- ret += ' [ ] [ ] </div>';
- } else {
- ret += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_".concat(function_obj.return_type.toLowerCase())) + '</div>';
- }
- ret += '<div class="menu">';
- for (var tm in _types__WEBPACK_IMPORTED_MODULE_0__.Types) {
- 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>';
- }
- 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">';
- for (var tm in _types__WEBPACK_IMPORTED_MODULE_0__.Types) {
- if (tm == _types__WEBPACK_IMPORTED_MODULE_0__.Types.VOID.toUpperCase()) {
- continue;
- }
- 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>';
- }
- ret += '</div></div>';
- 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">';
- for (var tm in _types__WEBPACK_IMPORTED_MODULE_0__.Types) {
- if (tm == _types__WEBPACK_IMPORTED_MODULE_0__.Types.VOID.toUpperCase()) {
- continue;
- }
- 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>';
- }
- ret += '</div></div>';
- ret += '</div></div>';
- ret = $(ret);
- function_element.find('.function_return').append(ret);
- }
- var cont = 0;
- function renderFunction(function_obj) {
- var appender = '<div class="ui secondary segment function_div list-group-item function_cont_' + cont + '">';
- if (function_obj.function_comment) {//appender += renderComment(function_obj.function_comment, sequence, true, -1);
- }
- appender += '<span class="glyphicon glyphicon-move move_function" aria-hidden="true"><i class="icon sort alternate vertical"></i></span>';
- 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>';
- appender += '<div class="function_signature_div">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("function") + ' ';
- if (function_obj.is_main) {
- appender += '<div class="function_name_div"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('type_void') + ' <span class="span_name_function" >' + function_obj.name + '</span> </div> ' + ' <span class="parethesis_function">( </span> <div class="ui large labels parameters_list">';
- } else {
- appender += '<div class="ui function_return"></div>';
- 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">';
- }
- appender += '</div> <span class="parethesis_function"> ) </span> </div>' + (function_obj.is_hidden ? ' <div class="function_area" style="display: none;"> ' : ' <div class="function_area"> ');
- appender += '<div class="ui add_var_context add_var_button_function" style="float: left;"> <div class="ui icon button purple"> ';
- 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>';
- appender += '</div></div>';
- appender += '<div class="ui top attached segment variables_list_div"></div>';
- 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;">';
- 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"> ';
- 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>';
- appender += '</div></div>' + '</div>';
- appender += '</div></div>';
- appender = $(appender);
- $('.all_functions').append(appender);
- appender.data('fun', function_obj);
- appender.find('.commands_list_div').data('fun', function_obj);
- renderFunctionReturn(function_obj, appender);
- addHandlers(function_obj, appender); // Rendering parameters:
- for (var j = 0; j < function_obj.parameters_list.length; j++) {
- renderParameter(function_obj, function_obj.parameters_list[j], appender);
- } // Rendering variables:
- for (var j = 0; j < function_obj.variables_list.length; j++) {
- _variables__WEBPACK_IMPORTED_MODULE_4__.renderVariable(appender, function_obj.variables_list[j], function_obj);
- } // Rendering commands:
- for (var j = 0; j < function_obj.commands.length; j++) {
- _commands__WEBPACK_IMPORTED_MODULE_5__.renderCommand(function_obj.commands[j], $(appender.find('.commands_list_div')[0]), 3, function_obj);
- }
- appender.find('.minimize_function_button').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_hide_function"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- appender.find('.move_function').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("btn_drag_and_drop_function"),
- delay: {
- show: 1000,
- hide: 0
- }
- });
- appender.find('.remove_function_button').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("btn_delete_function"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- appender.find('.add_var_button_function').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("btn_add_var"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- appender.find('a[data-command="attribution"]').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_menu_attribution"),
- position: 'right center',
- delay: {
- show: 750,
- hide: 0
- }
- });
- appender.find('a[data-command="functioncall"]').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_menu_call_function"),
- position: 'right center',
- delay: {
- show: 750,
- hide: 0
- }
- });
- appender.find('a[data-command="iftrue"]').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_menu_if_else"),
- position: 'right center',
- delay: {
- show: 750,
- hide: 0
- }
- });
- appender.find('a[data-command="comment"]').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_menu_comments"),
- position: 'right center',
- delay: {
- show: 750,
- hide: 0
- }
- });
- appender.find('a[data-command="reader"]').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_menu_read"),
- position: 'right center',
- delay: {
- show: 750,
- hide: 0
- }
- });
- appender.find('a[data-command="writer"]').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_menu_write"),
- position: 'right center',
- delay: {
- show: 750,
- hide: 0
- }
- });
- appender.find('a[data-command="repeatNtimes"]').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_menu_repeat_n_times"),
- position: 'right center',
- delay: {
- show: 750,
- hide: 0
- }
- });
- appender.find('a[data-command="whiletrue"]').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_menu_repeat_whiletrue"),
- position: 'right center',
- delay: {
- show: 750,
- hide: 0
- }
- });
- appender.find('a[data-command="dowhiletrue"]').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_menu_repeat_dowhiletrue"),
- position: 'right center',
- delay: {
- show: 750,
- hide: 0
- }
- });
- appender.find('a[data-command="switch"]').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_menu_repeat_switch"),
- position: 'right center',
- delay: {
- show: 750,
- hide: 0
- }
- });
- appender.find('a[data-command="return"]').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_menu_repeat_return"),
- position: 'right center',
- delay: {
- show: 750,
- hide: 0
- }
- });
- var function_index = program.functions.indexOf(function_obj);
- Sortable.create(appender.find(".variables_list_div")[0], {
- handle: '.ellipsis',
- animation: 100,
- ghostClass: 'ghost',
- group: 'local_vars_drag_' + function_index,
- onEnd: function onEnd(evt) {
- updateSequenceLocals(evt.oldIndex, evt.newIndex, function_obj);
- }
- });
- addSortableHandler(appender.find(".commands_list_div")[0], function_index);
- if (!function_obj.is_main) {
- Sortable.create(appender.find(".container_parameters_list")[0], {
- handle: '.ellipsis',
- animation: 100,
- ghostClass: 'ghost',
- group: 'parameters_drag_' + program.functions.indexOf(function_obj),
- onEnd: function onEnd(evt) {
- updateSequenceParameters(evt.oldIndex, evt.newIndex, function_obj);
- }
- });
- }
- if (function_obj.commands.length > 0) {
- var teste = '.ui.sticky.sticky_cont_' + cont;
- $(teste).sticky({
- context: '.ui.bottom.attached.segment.commands_list_div.commands_cont_' + cont,
- scrollContext: '.ivprog_visual_panel',
- observeChanges: true,
- offset: 40,
- onStick: function onStick(evt) {
- $(teste).css('top', '20px', 'important');
- },
- onBottom: function onBottom(evt) {
- $(teste).css('top', '20px', 'important');
- },
- onUnstick: function onUnstick(evt) {
- $(teste).css('top', '20px', 'important');
- },
- onReposition: function onReposition(evt) {
- $(teste).css('top', '20px', 'important');
- },
- onScroll: function onScroll(evt) {
- $(teste).css('top', '20px', 'important');
- if (!isVisible($(teste), $(teste).parent())) {
- $(teste).removeClass('fixed');
- }
- },
- onTop: function onTop(evt) {
- $(teste).css('top', '20px', 'important');
- }
- });
- }
- cont++;
- appender.find('.add_parameter_button').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_add_parameters"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- return appender;
- }
- function isVisible(element, container) {
- var elementTop = $(element).offset().top,
- elementHeight = $(element).height(),
- containerTop = $(container).offset().top,
- containerHeight = $(container).height() - 30;
- return elementTop - containerTop + elementHeight > 0 && elementTop - containerTop < containerHeight;
- }
- window.evento_drag;
- function updateProgramObjDrag() {
- var nodes = Array.prototype.slice.call($('.all_functions').children());
- var function_index;
- var start_index;
- var function_obj;
- $(evento_drag.item).parentsUntil(".all_functions").each(function (index) {
- var ref = $(this);
- if (ref.hasClass('function_div')) {
- function_index = nodes.indexOf(this);
- start_index = index;
- function_obj = ref;
- }
- });
- var path_target = [];
- $(evento_drag.item).parentsUntil(".all_functions").each(function () {
- if ($(this).hasClass('command_container')) {
- path_target.push(this);
- }
- });
- if (path_target.length == 0) {//console.log('soltou na raiz, na posição: ' + evento_drag.newIndex + ' mas ainda não sei de onde saiu ');
- } else {//console.log('soltou dentro de algum bloco, sequência vem logo abaixo (de baixo pra cima): ');
- //console.log(path_target);
- }
- var index_each = [];
- var path_relative = [];
- for (var i = path_target.length - 1; i >= 0; i--) {
- if (i == path_target.length - 1) {
- // está na raiz
- var indice_na_raiz = function_obj.find('.command_container').index(path_target[i]);
- } else {
- if ($(path_target[i + 1]).hasClass('iftrue')) {
- if ($(path_target[i]).parent().hasClass('commands_if')) {
- path_relative.push('if');
- index_each.push($(path_target[i]).parent().find('.command_container').index(path_target[i]));
- } else {
- path_relative.push('else');
- index_each.push($(path_target[i]).parent().find('.command_container').index(path_target[i]));
- }
- } else if ($(path_target[i + 1]).hasClass('dowhiletrue')) {
- path_relative.push('dowhiletrue');
- index_each.push($(path_target[i + 1]).find('.command_container').index(path_target[i]));
- } else if ($(path_target[i + 1]).hasClass('repeatNtimes')) {
- path_relative.push('repeatNtimes');
- index_each.push($(path_target[i + 1]).find('.command_container').index(path_target[i]));
- } else if ($(path_target[i + 1]).hasClass('whiletrue')) {
- path_relative.push('whiletrue');
- index_each.push($(path_target[i + 1]).find('.command_container').index(path_target[i]));
- } else if ($(path_target[i + 1]).hasClass('switch')) {
- path_relative.push('switch'); //index_each.push($(path_target[i + 1]).find('.command_container').index(path_target[i]));
- }
- }
- } // var index_in_block = -1;
- 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);
- var is_in_case_switch = $(evento_drag.item).parent().hasClass('case_commands_block'); // encontrar o elemento na árvore:
- var command_start_point = window.program_obj.functions[function_index].commands[indice_na_raiz];
- var block_to_insert = command_start_point;
- for (var i = 0; i < index_each.length; i++) {
- if (path_relative[i] == "else") {
- block_to_insert = block_to_insert.commands_else[index_each[i]];
- } else if (path_relative[i] == "switch") {} else {
- block_to_insert = block_to_insert.commands_block[index_each[i]];
- }
- } //console.log('command_start_point', command_start_point);
- //console.log('block_to_insert', block_to_insert);
- // agora tem que alocar o comando na árvore, mas considerar as quatro situações:
- // (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.
- if (path_target.length == 0) {
- // soltou na raiz:
- window.program_obj.functions[function_index].commands.splice(evento_drag.newIndex - 1, 0, command_in_drag);
- } else if (is_in_else) {
- if (block_to_insert.commands_else) {
- block_to_insert.commands_else.splice(evento_drag.newIndex, 0, command_in_drag);
- } else {
- block_to_insert.commands_else = [];
- block_to_insert.commands_else.push(command_in_drag);
- }
- } else if (is_in_case_switch) {} else {
- // verificar se tem alguma coisa no bloco:
- if (block_to_insert.commands_block) {
- block_to_insert.commands_block.splice(evento_drag.newIndex, 0, command_in_drag);
- } else {
- block_to_insert.commands_block = [];
- block_to_insert.commands_block.push(command_in_drag);
- }
- }
- window.draging = false;
- renderAlgorithm();
- }
- function prepareDragHandler(evt) {
- window.draging = true;
- var nodes = Array.prototype.slice.call($('.all_functions').children());
- var function_index;
- var function_obj;
- $(evt.item).parentsUntil(".all_functions").each(function (index) {
- if ($(this).hasClass('function_div')) {
- function_index = nodes.indexOf(this);
- function_obj = window.program_obj.functions[function_index];
- }
- });
- command_in_drag = $(evt.item).data("command"); //console.log('$(evt.item).parent(): ');
- //console.log($(evt.item).parent());
- // descobrir qual das quatro situações:
- if ($(evt.item).parent().hasClass('commands_list_div')) {
- // está na raiz:
- if (function_obj.commands.indexOf(command_in_drag) > -1) {
- function_obj.commands.splice(function_obj.commands.indexOf(command_in_drag), 1);
- }
- } else if ($(evt.item).parent().hasClass('commands_else')) {
- // está no else:
- if ($(evt.item).parent().data('command').commands_else.indexOf(command_in_drag) > -1) {
- $(evt.item).parent().data('command').commands_else.splice($(evt.item).parent().data('command').commands_else.indexOf(command_in_drag), 1);
- }
- } else if ($(evt.item).parent().hasClass('case_commands_block')) {// está em um switch:
- } else {
- // caso padrão:
- if ($(evt.item).parent().data('command').commands_block.indexOf(command_in_drag) > -1) {
- $(evt.item).parent().data('command').commands_block.splice($(evt.item).parent().data('command').commands_block.indexOf(command_in_drag), 1);
- }
- }
- }
- var command_in_drag;
- function addSortableHandler(element, id_function) {
- var n_group = 'commands_drag_' + id_function;
- Sortable.create(element, {
- handle: '.command_drag',
- ghostClass: 'ghost',
- animation: 300,
- group: {
- name: n_group
- },
- onEnd: function onEnd(evt) {
- var nodes = Array.prototype.slice.call($('.all_functions').children());
- var function_index;
- var function_obj;
- $(evt.item).parentsUntil(".all_functions").each(function (index) {
- if ($(this).hasClass('function_div')) {
- function_index = nodes.indexOf(this);
- function_obj = window.program_obj.functions[function_index];
- }
- });
- (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);
- var itemEl = evt.item; // dragged HTMLElement
- evt.to; // target list
- evt.from; // previous list
- evt.oldIndex; // element's old index within old parent
- evt.newIndex; // element's new index within new parent
- //console.log('::EVT::');
- //console.log(evt);
- window.evento_drag = evt;
- try {
- updateProgramObjDrag();
- } catch (e) {
- console.error(e);
- window.draging = false;
- }
- },
- onStart: function onStart(evt) {
- //console.log("START::EVT::");
- //console.log(evt);
- //console.log("\n\ncommand_in_drag");
- try {
- prepareDragHandler(evt);
- } catch (e) {
- window.draging = false;
- }
- }
- });
- element = $(element);
- element.find(".iftrue").each(function (index) {
- addSortableHandler($(this).find(".block_commands")[0], id_function);
- addSortableHandler($(this).find(".block_commands")[1], id_function);
- });
- element.find(".repeatNtimes").each(function (index) {
- addSortableHandler($(this).find(".block_commands")[0], id_function);
- });
- element.find(".dowhiletrue").each(function (index) {
- addSortableHandler($(this).find(".block_commands")[0], id_function);
- });
- element.find(".whiletrue").each(function (index) {
- addSortableHandler($(this).find(".block_commands")[0], id_function);
- });
- element.find(".switch").each(function (index) {
- $(this).find(".case_div").each(function (index) {
- addSortableHandler($(this).find(".case_commands_block")[0], id_function);
- });
- });
- }
- function initVisualUI() {
- // MUST USE CONST, LET, OR VAR !!!!!!
- // const mainDiv = $('#visual-main-div');
- // fill mainDiv with functions and globals...
- // renderAlgorithm()...
- domConsole = new _io_domConsole__WEBPACK_IMPORTED_MODULE_8__.DOMConsole("ivprog-term-div");
- domConsole.hide();
- $(document.getElementById("ivprog-term-div")).draggable();
- $('.add_function_button').on('click', function () {
- addFunctionHandler();
- }).popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_add_function"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- $('.add_global_button').on('click', function () {
- window.insertContext = true;
- _globals__WEBPACK_IMPORTED_MODULE_3__.addGlobal(program, true);
- });
- $('#run_button').on('click', function () {
- showStopButton();
- runCode();
- });
- $('#download_file_button').on('click', function () {
- downloadFile();
- });
- $('#upload_file_button').on('click', function () {
- $('#ivph_file').click().off('change').change(uploadFile);
- });
- $('#stop_button').on('click', function () {
- showRunButton();
- stopExecution();
- });
- $('.visual_coding_button').on('click', function () {
- toggleVisualCoding();
- });
- $('.textual_coding_button').on('click', function () {
- toggleTextualCoding();
- });
- $('.assessment').on('click', function () {
- is_iassign = true;
- runCodeAssessment();
- });
- $('.div_toggle_console').on('click', function () {
- toggleConsole();
- });
- $('.expand_button').on('click', function () {
- full_screen();
- });
- $('.help_button').on('click', function () {
- window.open('https://www.usp.br/line/ivprog/', '_blank');
- });
- $('.main_title h2').prop('title', _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('text_ivprog_description'));
- var time_show = 750;
- $('.visual_coding_button').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_visual"),
- delay: {
- show: time_show,
- hide: 0
- }
- });
- $('.textual_coding_button').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_textual"),
- delay: {
- show: time_show,
- hide: 0
- }
- });
- $('.upload_file_button').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_upload"),
- delay: {
- show: time_show,
- hide: 0
- }
- });
- $('.download_file_button').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_download"),
- delay: {
- show: time_show,
- hide: 0
- }
- });
- $('.undo_button').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_undo"),
- delay: {
- show: time_show,
- hide: 0
- }
- });
- $('.redo_button').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_redo"),
- delay: {
- show: time_show,
- hide: 0
- }
- });
- $('.run_button').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_run"),
- delay: {
- show: time_show,
- hide: 0
- }
- });
- $('.assessment_button').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_evaluate"),
- delay: {
- show: time_show,
- hide: 0
- }
- });
- $('.help_button').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_help") + ' - ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_ivprog_version") + ' ' + ivprog_version,
- delay: {
- show: time_show,
- hide: 0
- }
- });
- $('.add_global_button').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_add_global"),
- delay: {
- show: time_show,
- hide: 0
- }
- });
- $('.div_toggle_console').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_console"),
- delay: {
- show: time_show,
- hide: 0
- }
- });
- Sortable.create(listWithHandle, {
- handle: '.glyphicon-move',
- animation: 100,
- ghostClass: 'ghost',
- group: 'functions_divs_drag',
- onEnd: function onEnd(evt) {
- updateSequenceFunction(evt.oldIndex, evt.newIndex);
- }
- });
- var listGlobalsHandle = document.getElementById("listGlobalsHandle");
- Sortable.create(listGlobalsHandle, {
- handle: '.ellipsis',
- animation: 100,
- ghostClass: 'ghost',
- group: 'globals_divs_drag',
- onEnd: function onEnd(evt) {
- updateSequenceGlobals(evt.oldIndex, evt.newIndex);
- }
- });
- }
- function setTestCases(testCases) {
- _testCases = testCases;
- }
- function getTestCases() {
- // Deep clone of test cases to avoid unauthorized modification
- // TODO: It may be not possible to use this once custom test are fully implemented
- return JSON.parse(JSON.stringify(_testCases));
- }
- var is_iassign = false;
- function updateSequenceParameters(oldIndex, newIndex, function_obj) {
- function_obj.parameters_list.splice(newIndex, 0, function_obj.parameters_list.splice(oldIndex, 1)[0]);
- }
- function updateSequenceLocals(oldIndex, newIndex, function_obj) {
- function_obj.variables_list.splice(newIndex, 0, function_obj.variables_list.splice(oldIndex, 1)[0]);
- }
- function updateSequenceGlobals(oldIndex, newIndex) {
- program_obj.globals.splice(newIndex, 0, program_obj.globals.splice(oldIndex, 1)[0]);
- }
- function updateSequenceFunction(oldIndex, newIndex) {
- program_obj.functions.splice(newIndex, 0, program_obj.functions.splice(oldIndex, 1)[0]);
- }
- function runCodeAssessment() {
- if (isRunning) {
- // cannot run assessment or it's already running
- return -1;
- }
- var strCode = null;
- is_iassign = false;
- window.studentGrade = null;
- if (settingsProgrammingTypes == "textual") {
- strCode = _text_editor__WEBPACK_IMPORTED_MODULE_17__.getCode();
- } else {
- strCode = _code_generator__WEBPACK_IMPORTED_MODULE_6__.generate();
- }
- if (strCode == null) {
- // No code, so no assessment
- return -1;
- }
- toggleConsole(true);
- try {
- var data = _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_11__.SemanticAnalyser.analyseFromSource(strCode);
- isRunning = true;
- var runner = new _assessment_ivprogAssessment__WEBPACK_IMPORTED_MODULE_12__.IVProgAssessment(data, _testCases, domConsole);
- runner.runTest().then(function (grade) {
- if (!is_iassign) {
- parent.getEvaluationCallback(grade);
- } else {
- is_iassign = false;
- }
- isRunning = false;
- })["catch"](function (err) {
- console.log(err);
- isRunning = false;
- });
- } catch (error) {
- isRunning = false;
- domConsole.err(error.message);
- console.log(error);
- if (!is_iassign) {
- parent.getEvaluationCallback(0);
- } else {
- is_iassign = false;
- }
- }
- return 0;
- }
- function runCode() {
- if (isRunning) {
- return;
- }
- var strCode = null;
- if (settingsProgrammingTypes == "textual") {
- strCode = _text_editor__WEBPACK_IMPORTED_MODULE_17__.getCode();
- } else {
- strCode = _code_generator__WEBPACK_IMPORTED_MODULE_6__.generate();
- }
- if (strCode == null) {
- return;
- }
- toggleConsole(true); // if(domConsole == null)
- // domConsole = new DOMConsole("#ivprog-term");
- //$("#ivprog-term").slideDown(500);
- try {
- var data = _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_11__.SemanticAnalyser.analyseFromSource(strCode);
- proc = new _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_9__.IVProgProcessor(data);
- proc.registerInput(domConsole);
- proc.registerOutput(domConsole);
- $("#ivprog-term").addClass('ivprog-term-active');
- isRunning = true;
- proc.interpretAST().then(function (_) {
- scheduleCall(function () {
- if (domConsole.pending_writes.length == 0) {
- if (proc.mode === _processor_modes__WEBPACK_IMPORTED_MODULE_19__.Modes.ABORT) {
- domConsole.info(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getMessage("aborted_execution"));
- } else {
- domConsole.info(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getMessage("success_execution"));
- }
- $("#ivprog-term").removeClass('ivprog-term-active');
- isRunning = false;
- proc = null;
- showRunButton();
- return true;
- }
- return false;
- }, 100);
- })["catch"](function (err) {
- scheduleCall(function () {
- if (domConsole.pending_writes.length == 0) {
- if (err instanceof Error) {
- domConsole.err(err.message);
- } else {
- domConsole.err(err);
- }
- $("#ivprog-term").removeClass('ivprog-term-active');
- isRunning = false;
- proc = null;
- showRunButton();
- return true;
- }
- return false;
- }, 100);
- });
- } catch (error) {
- scheduleCall(function () {
- if (domConsole.pending_writes.length == 0) {
- isRunning = false;
- proc = null;
- showRunButton();
- domConsole.err(error.message);
- console.log(error);
- return true;
- }
- return false;
- }, 100);
- }
- }
- function toggleConsole(is_running) {
- if (is_running) {
- $('.ivprog-term-div').css('display', 'block');
- $('#ivprog-term').css('min-height', '160px');
- if (domConsole != null) domConsole.focus(); //$('#ivprog-term').css('margin-top', '-170px');
- return;
- } else {
- domConsole.hide();
- return;
- }
- if ($('#ivprog-term').css('min-height') == '160px') {
- // esconder
- $('.ivprog-term-div').css('display', 'none');
- $('#ivprog-term').css('min-height', '0'); //$('#ivprog-term').css('margin-top', '-30px');
- //$('#ivprog-term').css('padding', '5px');
- } else {
- // mostrar
- $('.ivprog-term-div').css('display', 'block');
- $('#ivprog-term').css('min-height', '160px'); //$('#ivprog-term').css('margin-top', '-170px');
- }
- } // function waitToCloseConsole () {
- // domConsole.info("Aperte qualquer tecla para fechar...");
- // const p = new Promise((resolve, _) => {
- // domConsole.requestInput(resolve, true);
- // });
- // p.then( _ => {
- // domConsole.dispose();
- // domConsole = null;
- // $("#ivprog-term").hide();
- // })
- // }
- function toggleTextualCoding() {
- var code = null;
- if (settingsProgrammingTypes != "textual") {
- code = _code_generator__WEBPACK_IMPORTED_MODULE_6__.generate();
- if (code == null) {
- return;
- }
- }
- $('.ivprog_visual_panel').css('display', 'none');
- $('.ivprog_textual_panel').css('display', 'block');
- $('.ivprog_textual_panel').removeClass('loading');
- _text_editor__WEBPACK_IMPORTED_MODULE_17__.updateEditor();
- if (code != null) _text_editor__WEBPACK_IMPORTED_MODULE_17__.setCode(code); //$('.ivprog_textual_code').text(code);
- $('.visual_coding_button').removeClass('active');
- $('.textual_coding_button').addClass('active');
- }
- function toggleVisualCoding() {
- $('.ivprog_textual_panel').addClass('loading');
- $('.ivprog_textual_panel').css('display', 'none');
- $('.ivprog_visual_panel').css('display', 'block');
- $('.textual_coding_button').removeClass('active');
- $('.visual_coding_button').addClass('active');
- }
- function removeParameter(function_obj, parameter_obj, parameter_container) {
- (0,_services_userLog__WEBPACK_IMPORTED_MODULE_15__.registerUserEvent)(parameter_obj.name, _services_userLog__WEBPACK_IMPORTED_MODULE_15__.ActionTypes.REMOVE_FUNCTION_PARAM, function_obj.name);
- var index = function_obj.parameters_list.indexOf(parameter_obj);
- if (index > -1) {
- window.insertContext = true;
- function_obj.parameters_list.splice(index, 1);
- }
- $(parameter_container).fadeOut();
- }
- function updateParameterType(parameter_obj, new_type, function_name) {
- var new_dimensions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
- (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);
- parameter_obj.type = new_type;
- parameter_obj.dimensions = new_dimensions;
- if (new_dimensions > 0) {
- parameter_obj.rows = new_dimensions;
- parameter_obj.columns = 2;
- }
- }
- function renderParameter(function_obj, parameter_obj, function_container) {
- var ret = "";
- ret += '<div class="ui label function_name_parameter pink"><i class="ui icon ellipsis vertical inverted"></i>';
- if (parameter_obj.reference) ret += '<input type="checkbox" checked class="by_reference">';else ret += '<input type="checkbox" class="by_copy">';
- ret += '<div class="ui dropdown parameter_type">';
- if (parameter_obj.dimensions > 0) {
- 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()));
- if (parameter_obj.dimensions == 1) {
- ret += ' [ ] ';
- } else {
- ret += ' [ ] [ ] ';
- }
- ret += '</div>';
- } else {
- ret += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_".concat(parameter_obj.type.toLowerCase())) + '</div>';
- }
- ret += '<div class="menu">';
- for (var _tm in _types__WEBPACK_IMPORTED_MODULE_0__.Types) {
- if (_tm == _types__WEBPACK_IMPORTED_MODULE_0__.Types.VOID.toUpperCase()) {
- continue;
- }
- 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>';
- }
- 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">';
- for (var tm in _types__WEBPACK_IMPORTED_MODULE_0__.Types) {
- if (tm == _types__WEBPACK_IMPORTED_MODULE_0__.Types.VOID.toUpperCase()) {
- continue;
- }
- 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>';
- }
- ret += '</div></div>';
- 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">';
- for (var tm in _types__WEBPACK_IMPORTED_MODULE_0__.Types) {
- if (tm == _types__WEBPACK_IMPORTED_MODULE_0__.Types.VOID.toUpperCase()) {
- continue;
- }
- 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>';
- }
- ret += '</div></div>';
- ret += '</div></div>';
- ret += '<div class="parameter_div_edit"><span class="span_name_parameter label_enable_name_parameter">' + parameter_obj.name + '</span></div> ';
- ret += ' <i class="yellow inverted icon times remove_parameter"></i></div>';
- ret = $(ret);
- function_container.find('.container_parameters_list').append(ret);
- ret.find('.remove_parameter').on('click', function (e) {
- removeParameter(function_obj, parameter_obj, ret);
- });
- ret.find('.ui.dropdown.parameter_type').dropdown({
- onChange: function onChange(_, __, $selectedItem) {
- if ($selectedItem.data('dimensions')) {
- updateParameterType(parameter_obj, _types__WEBPACK_IMPORTED_MODULE_0__.Types[$selectedItem.data('type')], function_obj.name, $selectedItem.data('dimensions'));
- } else {
- updateParameterType(parameter_obj, _types__WEBPACK_IMPORTED_MODULE_0__.Types[$selectedItem.data('type')], function_obj.name);
- }
- },
- selectOnKeydown: false
- });
- ret.find('.parameter_div_edit').on('click', function (e) {
- (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);
- enableNameParameterUpdate(parameter_obj, ret, function_obj);
- });
- ret.find('input:checkbox').change(function () {
- parameter_obj.reference = this.checked;
- _algorithm__WEBPACK_IMPORTED_MODULE_13__.renderAlgorithm();
- });
- ret.find('.by_reference').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_parameter_reference"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- ret.find('.by_copy').popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_parameter_copy"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- return ret;
- }
- function updateParameterName(parameter_var, new_name, parameter_obj_dom, function_obj) {
- if (parameter_var.name == new_name) {
- return;
- }
- if ((0,_util_utils__WEBPACK_IMPORTED_MODULE_18__.isValidIdentifier)(new_name)) {
- if (variableNameAlreadyExists(new_name, function_obj)) {
- _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]));
- } else {
- (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);
- parameter_var.name = new_name;
- }
- } else {
- _utils__WEBPACK_IMPORTED_MODULE_14__.renderErrorMessage(parameter_obj_dom.find('.parameter_div_edit'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getError('inform_valid_identifier'));
- }
- }
- function variableNameAlreadyExists(name_var, function_obj) {
- if (function_obj.parameters_list) {
- for (var i = 0; i < function_obj.parameters_list.length; i++) {
- if (function_obj.parameters_list[i].name == name_var) {
- return true;
- }
- }
- }
- if (function_obj.variables_list) {
- for (var i = 0; i < function_obj.variables_list.length; i++) {
- if (function_obj.variables_list[i].name == name_var) {
- return true;
- }
- }
- }
- return false;
- }
- function updateFunctionName(function_var, new_name, function_obj_dom) {
- if (function_var.name == new_name) {
- return;
- }
- if ((0,_util_utils__WEBPACK_IMPORTED_MODULE_18__.isValidIdentifier)(new_name)) {
- if (functionNameAlreadyExists(new_name)) {
- _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]));
- } else {
- (0,_services_userLog__WEBPACK_IMPORTED_MODULE_15__.registerUserEvent)(function_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_15__.ActionTypes.RENAME_FUNCTION, new_name);
- function_var.name = new_name;
- }
- } else {
- _utils__WEBPACK_IMPORTED_MODULE_14__.renderErrorMessage(function_obj_dom.find('.function_name_div'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getError('inform_valid_identifier'));
- }
- }
- function functionNameAlreadyExists(function_name) {
- for (var i = 0; i < window.program_obj.functions.length; i++) {
- if (window.program_obj.functions[i].name == function_name) {
- return true;
- }
- }
- return false;
- }
- var opened_name_parameter = false;
- var opened_input_parameter = null;
- function enableNameParameterUpdate(parameter_obj, parent_node, function_obj) {
- if (opened_name_parameter) {
- opened_input_parameter.focus();
- return;
- }
- opened_name_parameter = true;
- parent_node = $(parent_node);
- var input_field;
- parent_node.find('.span_name_parameter').text('');
- input_field = $("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + parameter_obj.name + "' />");
- input_field.insertBefore(parent_node.find('.span_name_parameter'));
- input_field.on('input', function () {
- var inputWidth = input_field.textWidth() + 10;
- opened_input_parameter = input_field;
- input_field.focus();
- var tmpStr = input_field.val();
- input_field.val('');
- input_field.val(tmpStr);
- input_field.css({
- width: inputWidth
- });
- }).trigger('input');
- input_field.focusout(function () {
- /// update array:
- if (input_field.val().trim()) {
- updateParameterName(parameter_obj, input_field.val().trim(), parent_node, function_obj);
- parent_node.find('.span_name_parameter').text(parameter_obj.name);
- }
- input_field.off();
- input_field.remove(); /// update elements:
- opened_name_parameter = false;
- opened_input_parameter = false;
- });
- input_field.on('keydown', function (e) {
- var code = e.keyCode || e.which;
- if (code == 13) {
- if (input_field.val().trim()) {
- updateParameterName(parameter_obj, input_field.val().trim(), parent_node, function_obj);
- parent_node.find('.span_name_parameter').text(parameter_obj.name);
- }
- input_field.off();
- input_field.remove(); /// update elements:
- opened_name_parameter = false;
- opened_input_parameter = false;
- }
- if (code == 27) {
- parent_node.find('.span_name_parameter').text(parameter_obj.name);
- input_field.off();
- input_field.remove(); /// update elements:
- opened_name_parameter = false;
- opened_input_parameter = false;
- }
- });
- input_field.select();
- }
- var opened_name_function = false;
- var opened_input = null;
- var previousPadding = null;
- function enableNameFunctionUpdate(function_obj, parent_node) {
- if (opened_name_function) {
- opened_input.focus();
- return;
- }
- parent_node = $(parent_node);
- parent_node.find('.span_name_function').text('');
- var input_field;
- if (!previousPadding) {
- previousPadding = parent_node.find('.span_name_function').css('padding-left');
- }
- parent_node.find('.span_name_function').css('padding-left', '0');
- parent_node.find('.span_name_function').css('padding-right', '0');
- input_field = $("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + function_obj.name + "' />");
- input_field.insertBefore(parent_node.find('.span_name_function'));
- input_field.on('input', function () {
- var inputWidth = input_field.textWidth() + 10;
- opened_input = input_field;
- input_field.focus();
- var tmpStr = input_field.val();
- input_field.val('');
- input_field.val(tmpStr);
- input_field.css({
- width: inputWidth
- });
- }).trigger('input');
- input_field.focusout(function () {
- /// update array:
- if (input_field.val().trim()) {
- updateFunctionName(function_obj, input_field.val().trim(), parent_node);
- }
- input_field.off();
- input_field.remove();
- parent_node.find('.span_name_function').css('padding-left', previousPadding);
- parent_node.find('.span_name_function').css('padding-right', previousPadding);
- parent_node.find('.span_name_function').text(function_obj.name); /// update elements:
- opened_name_function = false;
- opened_input = false;
- });
- input_field.on('keydown', function (e) {
- var code = e.keyCode || e.which;
- if (code == 13) {
- if (input_field.val().trim()) {
- updateFunctionName(function_obj, input_field.val().trim(), parent_node);
- }
- input_field.off();
- input_field.remove();
- parent_node.find('.span_name_function').css('padding-left', previousPadding);
- parent_node.find('.span_name_function').css('padding-right', previousPadding);
- parent_node.find('.span_name_function').text(function_obj.name); /// update elements:
- opened_name_function = false;
- opened_input = false;
- }
- if (code == 27) {
- input_field.off();
- input_field.remove();
- parent_node.find('.span_name_function').css('padding-left', previousPadding);
- parent_node.find('.span_name_function').css('padding-right', previousPadding);
- parent_node.find('.span_name_function').text(function_obj.name); /// update elements:
- opened_name_function = false;
- opened_input = false;
- }
- });
- input_field.select();
- }
- function addFunctionChangeListener(callback) {
- functionsChangeListeners.push(callback);
- return functionsChangeListeners.length - 1;
- }
- function addGlobalChangeListener(callback) {
- globalChangeListeners.push(callback);
- return globalChangeListeners.length - 1;
- }
- function removeGlobalListener(index) {
- globalChangeListeners.splice(index, 1);
- }
- function removeFunctionListener(index) {
- functionsChangeListeners.splice(index);
- }
- function scheduleCall(callback, time) {
- var scheduled_call = function scheduled_call() {
- var id = setInterval(function () {
- if (callback()) {
- clearInterval(id);
- }
- }, time);
- };
- scheduled_call();
- }
- function showRunButton() {
- document.getElementById('run_button').style.display = 'inline';
- document.getElementById('stop_button').style.display = 'none';
- }
- function showStopButton() {
- document.getElementById('run_button').style.display = 'none';
- document.getElementById('stop_button').style.display = 'inline';
- }
- function stopExecution() {
- domConsole.clearPendingWrites();
- domConsole.cancelPendingInputRequests();
- if (!isRunning) {
- return;
- }
- proc.mode = _processor_modes__WEBPACK_IMPORTED_MODULE_19__.Modes.ABORT;
- }
- function downloadFile() {
- var contentToSend = '{}\n::algorithm::';
- contentToSend = generator();
- var date = new Date();
- var temp = date.toISOString().split('T')[0] + "_" + date.toTimeString().split(' ')[0].replaceAll(':', '-');
- var blob = new Blob([contentToSend], {
- type: "text/plain;charset=utf-8"
- });
- saveAs(blob, "ivprog-exported_" + temp + ".ivph");
- }
- function uploadFile(evt) {
- var oFReader = new FileReader();
- oFReader.readAsText(document.getElementById("ivph_file").files[0]);
- oFReader.onload = function (oFREvent) {
- var txt = oFREvent.target.result;
- try {
- ivprogCore.setPreviousAlgorithm(txt);
- window.renderAlgorithm();
- } catch (e) {
- showInvalidFile();
- }
- };
- }
- /***/ }),
- /***/ "./js/visualUI/globals.js":
- /*!********************************!*\
- !*** ./js/visualUI/globals.js ***!
- \********************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "addGlobal": () => (/* binding */ addGlobal),
- /* harmony export */ "renderGlobal": () => (/* binding */ renderGlobal)
- /* harmony export */ });
- /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
- /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
- /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
- /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
- /* harmony import */ var _services_userLog__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./../services/userLog */ "./js/services/userLog.js");
- var counter_new_globals = 0;
- function addGlobal(program) {
- var is_from_click = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- // Verify if the next global name is in use:
- if (program.globals) {
- var in_use = false;
- do {
- in_use = false;
- var temp_name = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('new_global') + '_' + counter_new_globals;
- program.globals.forEach(function (el) {
- if (temp_name == el.name) {
- in_use = true;
- }
- });
- if (in_use) counter_new_globals++;
- } while (in_use);
- }
- 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);
- counter_new_globals++;
- program.addGlobal(new_global);
- (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(new_global.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.INSERT_GLOBAL_VAR);
- var newe = renderGlobal(new_global);
- if (is_from_click) {
- newe.css('display', 'none');
- newe.fadeIn();
- }
- }
- function toggleConstant(global_var) {
- global_var.is_constant = !global_var.is_constant;
- (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.SET_GLOBAL_CONST);
- }
- function updateName(global_var, new_name, global_obj_dom) {
- if (global_var.name == new_name) {
- return;
- }
- if (isValidIdentifier(new_name)) {
- if (globalNameAlreadyExists(new_name)) {
- _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'));
- } else {
- (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.RENAME_GLOBAL_VAR, new_name);
- global_var.name = new_name;
- }
- } else {
- _utils__WEBPACK_IMPORTED_MODULE_3__.renderErrorMessage(global_obj_dom.find('.editing_name_var'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('inform_valid_name'));
- }
- }
- function globalNameAlreadyExists(global_name) {
- for (var i = 0; i < window.program_obj.globals.length; i++) {
- if (window.program_obj.globals[i].name == global_name) {
- return true;
- }
- }
- return false;
- }
- function isValidIdentifier(identifier_str) {
- return /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(identifier_str);
- }
- function updateType(global_var, new_type) {
- var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
- global_var.type = new_type;
- global_var.dimensions = new_dimensions;
- if (new_dimensions > 0) {
- global_var.rows = new_dimensions;
- global_var.columns = 2;
- }
- (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);
- updateInitialValues(global_var);
- }
- function removeGlobal(global_var, global_container) {
- var index = window.program_obj.globals.indexOf(global_var);
- if (index > -1) {
- window.insertContext = true;
- window.program_obj.globals.splice(index, 1);
- }
- (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.REMOVE_GLOBAL_VAR);
- global_container.children().off();
- global_container.off();
- global_container.fadeOut();
- }
- function updateInitialValues(global_var) {
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
- if (global_var.dimensions == 0) {
- global_var.value = 0;
- }
- if (global_var.dimensions == 1) {
- global_var.value = [0, 0];
- }
- if (global_var.dimensions == 2) {
- global_var.value = [[0, 0], [0, 0]];
- }
- }
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- if (global_var.dimensions == 0) {
- global_var.value = 0.0;
- }
- if (global_var.dimensions == 1) {
- global_var.value = [0.0, 0.0];
- }
- if (global_var.dimensions == 2) {
- global_var.value = [[0.0, 0.0], [0.0, 0.0]];
- }
- }
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
- if (global_var.dimensions == 0) {
- global_var.value = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('textvar_default_value');
- }
- if (global_var.dimensions == 1) {
- 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')];
- }
- if (global_var.dimensions == 2) {
- 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')]];
- }
- }
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
- if (global_var.dimensions == 0) {
- global_var.value = true;
- }
- if (global_var.dimensions == 1) {
- global_var.value = [true, true];
- }
- if (global_var.dimensions == 2) {
- global_var.value = [[true, true], [true, true]];
- }
- }
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR) {
- if (global_var.dimensions == 0) {
- global_var.value = 'A';
- }
- if (global_var.dimensions == 1) {
- global_var.value = ['A', 'A'];
- }
- if (global_var.dimensions == 2) {
- global_var.value = [['A', 'A'], ['A', 'A']];
- }
- }
- (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);
- }
- function alternateBooleanGlobalValue(global_var, value_container) {
- global_var.value = !global_var.value;
- $(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_".concat(global_var.value)));
- }
- function alternateBooleanGlobalVectorValue(global_var, index, value_container) {
- global_var.value[index] = !global_var.value[index];
- $(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_".concat(global_var.value[index])));
- }
- function removeGlobalColumnVector(global_var) {
- if (global_var.columns == 0) {
- return;
- }
- global_var.columns--;
- global_var.value.splice(global_var.value.length - 1, 1);
- }
- function addGlobalColumnVector(global_var) {
- global_var.columns++;
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
- global_var.value.push(0);
- }
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- global_var.value.push(0.0);
- }
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
- global_var.value.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('textvar_default_value'));
- }
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
- global_var.value.push(true);
- }
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR) {
- global_var.value.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('charvar_default_value'));
- }
- }
- function removeColumnGlobalMatrix(global_var) {
- if (global_var.columns == 0) {
- return;
- }
- global_var.columns--;
- for (var i = 0; i < global_var.rows; i++) {
- global_var.value[i].splice(global_var.value[i].length - 1, 1);
- }
- }
- function addColumnGlobalMatrix(global_var) {
- global_var.columns++;
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
- for (var i = 0; i < global_var.rows; i++) {
- global_var.value[i].push(0);
- }
- }
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- for (var i = 0; i < global_var.rows; i++) {
- global_var.value[i].push(0.0);
- }
- }
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
- for (var i = 0; i < global_var.rows; i++) {
- global_var.value[i].push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('textvar_default_value'));
- }
- }
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
- for (var i = 0; i < global_var.rows; i++) {
- global_var.value[i].push(true);
- }
- }
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR) {
- for (var i = 0; i < global_var.rows; i++) {
- global_var.value[i].push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('charvar_default_value'));
- }
- }
- }
- function removeLineGlobalMatrix(global_var) {
- if (global_var.rows == 0) {
- return;
- }
- global_var.rows--;
- global_var.value.splice(global_var.value.length - 1, 1);
- }
- function addLineGlobalMatrix(global_var) {
- global_var.rows++;
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
- var n_l = [];
- for (var i = 0; i < global_var.columns; i++) {
- n_l.push(0);
- }
- global_var.value.push(n_l);
- }
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- var n_l = [];
- for (i = 0; i < global_var.columns; i++) {
- n_l.push(0.0);
- }
- global_var.value.push(n_l);
- }
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
- var n_l = [];
- for (i = 0; i < global_var.columns; i++) {
- n_l.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('textvar_default_value'));
- }
- global_var.value.push(n_l);
- }
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
- var n_l = [];
- for (i = 0; i < global_var.columns; i++) {
- n_l.push(true);
- }
- global_var.value.push(n_l);
- }
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR) {
- var n_l = [];
- for (i = 0; i < global_var.columns; i++) {
- n_l.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('charvar_default_value'));
- }
- global_var.value.push(n_l);
- }
- }
- function alternateBooleanGlobalMatrixValue(global_var, row, index, value_container) {
- global_var.value[row][index] = !global_var.value[row][index];
- $(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_".concat(global_var.value[row][index])));
- }
- function renderValues(global_var, global_container) {
- var ret = "";
- var j = 0;
- if (global_var.dimensions == 0) {
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + parseFloat(global_var.value).toFixed(1) + '</span> </div> ';
- } else {
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
- 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> ';
- } else {
- ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + global_var.value + '</span> </div> ';
- }
- }
- } else {
- ret += '<table class="tabela_var">';
- if (global_var.dimensions == 1) {
- ret += '<tr>';
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- for (var k = 0; k < global_var.columns; k++) {
- ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + parseFloat(global_var.value[k]).toFixed(1) + '</span></td>';
- }
- } else {
- for (var k = 0; k < global_var.columns; k++) {
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
- 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>';
- } else {
- ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + global_var.value[k] + '</span>' + '</td>';
- }
- }
- }
- ret += '</tr>';
- ret += '</table>';
- 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>';
- }
- if (global_var.dimensions == 2) {
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- for (var l = 0; l < global_var.rows; l++) {
- ret += '<tr>';
- for (var k = 0; k < global_var.columns; k++) {
- 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>';
- }
- ret += '</tr>';
- }
- } else {
- for (var l = 0; l < global_var.rows; l++) {
- ret += '<tr>';
- for (var k = 0; k < global_var.columns; k++) {
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
- 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>';
- } else {
- ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + global_var.value[l][k] + '</span></td>';
- }
- }
- ret += '</tr>';
- }
- }
- if (global_var.rows == 0) {
- ret += '<tr><td></td></tr>';
- }
- 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>';
- ret += '</table>';
- 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>';
- }
- }
- global_container.find(".div_valor_var").html('');
- ret = $(ret);
- ret.find('.span_value_variable').data('associatedOject', global_var);
- ret.find(".boolean_simple_type").on('click', function (e) {
- alternateBooleanGlobalValue(global_var, this.parentNode);
- (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
- });
- ret.find(".simple_var").on('click', function (e) {
- (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.ENTER_CHANGE_GLOBAL_VALUE);
- enableGlobalValueUpdate(global_var, this.parentNode);
- });
- ret.find(".boolean_vector_var").on('click', function (e) {
- alternateBooleanGlobalVectorValue(global_var, $(this).data('index'), this.parentNode);
- (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
- });
- ret.find(".vector_var").on('click', function (e) {
- (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.ENTER_CHANGE_GLOBAL_VALUE);
- enableGlobalVectorValueUpdate(global_var, $(this).data('index'), this.parentNode);
- });
- ret.find(".remove_global_vector_column").on('click', function (e) {
- removeGlobalColumnVector(global_var);
- global_container.find(".div_valor_var").html('');
- (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);
- (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerSystemEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
- renderValues(global_var, global_container);
- });
- ret.find(".add_global_vector_column").on('click', function (e) {
- addGlobalColumnVector(global_var);
- (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);
- (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerSystemEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
- global_container.find(".div_valor_var").html('');
- renderValues(global_var, global_container);
- });
- ret.find(".remove_global_matrix_column").on('click', function (e) {
- removeColumnGlobalMatrix(global_var);
- (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);
- (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerSystemEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
- global_container.find(".div_valor_var").html('');
- renderValues(global_var, global_container);
- });
- ret.find(".add_global_matrix_column").on('click', function (e) {
- addColumnGlobalMatrix(global_var);
- (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);
- (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerSystemEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
- global_container.find(".div_valor_var").html('');
- renderValues(global_var, global_container);
- });
- ret.find(".remove_global_matrix_line").on('click', function (e) {
- removeLineGlobalMatrix(global_var);
- (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);
- (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerSystemEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
- global_container.find(".div_valor_var").html('');
- renderValues(global_var, global_container);
- });
- ret.find(".add_global_matrix_line").on('click', function (e) {
- addLineGlobalMatrix(global_var);
- (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);
- (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerSystemEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
- global_container.find(".div_valor_var").html('');
- renderValues(global_var, global_container);
- });
- ret.find(".boolean_matrix_var").on('click', function (e) {
- alternateBooleanGlobalMatrixValue(global_var, $(this).data('row'), $(this).data('index'), this.parentNode);
- (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
- });
- ret.find(".matrix_var").on('click', function (e) {
- (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.ENTER_CHANGE_GLOBAL_VALUE);
- enableGlobalMatrixValueUpdate(global_var, $(this).data('row'), $(this).data('index'), this.parentNode);
- });
- global_container.find(".div_valor_var").append(ret);
- updateColumnsAndRowsText(global_container, global_var);
- }
- function addHandlers(global_container) {
- var global_var = global_container.data('associatedOject'); // Manage constant option:
- global_container.find(".alternate_constant").on('click', function (e) {
- toggleConstant(global_var);
- $(this).removeClass("on off");
- if (global_var.is_constant) {
- $(this).addClass("on");
- } else {
- $(this).addClass("off");
- }
- }); // Manage global name:
- global_container.find(".editing_name_var").on('click', function (e) {
- (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.ENTER_CHANGE_GLOBAL_NAME);
- enableNameUpdate(global_container);
- }); // Menu to change type:
- global_container.find('.ui.dropdown.global_type').dropdown({
- onChange: function onChange(_, __, $selectedItem) {
- if ($selectedItem.data('dimensions')) {
- updateType(global_var, _types__WEBPACK_IMPORTED_MODULE_0__.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
- } else {
- updateType(global_var, _types__WEBPACK_IMPORTED_MODULE_0__.Types[$selectedItem.data('type')]);
- }
- renderValues(global_var, global_container);
- },
- selectOnKeydown: false
- }); // Remove global:
- global_container.find(".remove_global").on('click', function (e) {
- removeGlobal(global_var, global_container);
- });
- global_container.find(".ellipsis").popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_move_var"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- global_container.find(".remove_global").popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_remove_var"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- }
- function updateColumnsAndRowsText(global_container, global_var) {
- var prev = global_container.find('.text').text().split('[');
- if (prev.length == 2) {
- var ff = prev[0] + '[ ' + global_var.columns + ' ] ';
- global_container.find('.text').empty();
- global_container.find('.text').text(ff);
- }
- if (prev.length == 3) {
- var ff = prev[0] + '[ ' + global_var.columns + ' ] [ ' + global_var.rows + ' ] ';
- global_container.find('.text').empty();
- global_container.find('.text').text(ff);
- }
- }
- function renderGlobal(global_var) {
- var element = '<div class="ui label global_container pink"><i class="ui icon ellipsis vertical inverted"></i><div class="global_const">const: ';
- element += '<i class="ui icon toggle ' + (global_var.is_constant ? "on" : "off") + ' alternate_constant"></i></div>';
- element += '<div class="ui dropdown global_type">';
- if (global_var.dimensions == 1) {
- 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));
- element += ' [ <span class="dimensions_0"></span> ] ';
- element += '</div>';
- } else if (global_var.dimensions == 2) {
- 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));
- element += ' [ <span class="dimensions_0"></span> ] [ <span class="dimensions_1"></span> ] ';
- element += '</div>';
- } else {
- element += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_".concat(global_var.type.toLowerCase())) + '</div>';
- }
- element += '<div class="menu">';
- for (var tm in _types__WEBPACK_IMPORTED_MODULE_0__.Types) {
- if (tm == _types__WEBPACK_IMPORTED_MODULE_0__.Types.VOID.toUpperCase()) {
- continue;
- }
- 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>';
- }
- 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">';
- for (var tm in _types__WEBPACK_IMPORTED_MODULE_0__.Types) {
- if (tm == _types__WEBPACK_IMPORTED_MODULE_0__.Types.VOID.toUpperCase()) {
- continue;
- }
- 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>';
- }
- element += '</div></div>';
- 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">';
- for (var tm in _types__WEBPACK_IMPORTED_MODULE_0__.Types) {
- if (tm == _types__WEBPACK_IMPORTED_MODULE_0__.Types.VOID.toUpperCase()) {
- continue;
- }
- 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>';
- }
- element += '</div></div>';
- 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"> <— </span> ';
- element += '<div class="ui div_valor_var">' + global_var.value + '</div>';
- element += ' <i class="yellow inverted icon times remove_global"></i></div>';
- var complete_element = $(element);
- complete_element.data('associatedOject', global_var);
- $('.list_globals').append(complete_element);
- addHandlers(complete_element);
- renderValues(global_var, complete_element);
- if (global_var.dimensions == 1) {
- complete_element.find('.dimensions_0').text(global_var.columns);
- }
- if (global_var.dimensions == 2) {
- complete_element.find('.dimensions_0').text(global_var.columns);
- complete_element.find('.dimensions_1').text(global_var.rows);
- }
- return complete_element;
- }
- var opened_name_value_matrix_global_v = false;
- var opened_input_value_matrix_global_v = null;
- function enableGlobalMatrixValueUpdate(global_var, row, index, parent_node) {
- if (opened_name_value_matrix_global_v) {
- opened_input_value_matrix_global_v.focus();
- return;
- }
- parent_node = $(parent_node);
- opened_name_value_matrix_global_v = true;
- parent_node.find('.span_value_variable').text('');
- var input_field;
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- 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) + "' />");
- input_field.insertBefore(parent_node.find('.span_value_variable'));
- } else {
- 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] + "' />");
- input_field.insertBefore(parent_node.find('.span_value_variable'));
- }
- input_field.on('input', function () {
- var inputWidth = input_field.textWidth() + 10;
- opened_input_value_matrix_global_v = input_field;
- input_field.focus();
- var tmpStr = input_field.val();
- input_field.val('');
- input_field.val(tmpStr);
- input_field.css({
- width: inputWidth
- });
- }).trigger('input');
- input_field.focusout(function () {
- /// update array:
- if (input_field.val().trim()) {
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- global_var.value[row][index] = parseFloat(input_field.val().trim());
- parent_node.find('.span_value_variable').text(parseFloat(global_var.value[row][index]).toFixed(1));
- } else {
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
- global_var.value[row][index] = parseInt(input_field.val().trim());
- } else {
- global_var.value[row][index] = input_field.val().trim();
- }
- parent_node.find('.span_value_variable').text(global_var.value[row][index]);
- }
- (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
- } else {
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
- } else {
- parent_node.find('.span_value_variable').text(global_var.value[row][index]);
- }
- }
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
- global_var.value[row][index] = input_field.val();
- parent_node.find('.span_value_variable').text(global_var.value[row][index]);
- }
- input_field.off();
- input_field.remove(); /// update elements:
- opened_name_value_matrix_global_v = false;
- opened_input_value_matrix_global_v = false;
- });
- input_field.on('keydown', function (e) {
- var code = e.keyCode || e.which;
- if (code == 13) {
- if (input_field.val().trim()) {
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- global_var.value[row][index] = parseFloat(input_field.val().trim());
- parent_node.find('.span_value_variable').text(parseFloat(global_var.value[row][index]).toFixed(1));
- } else {
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
- global_var.value[row][index] = parseInt(input_field.val().trim());
- } else {
- global_var.value[row][index] = input_field.val().trim();
- }
- parent_node.find('.span_value_variable').text(global_var.value[row][index]);
- }
- (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
- } else {
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- parent_node.find('.span_value_variable').text(parseFloat(global_var.value[row][index]).toFixed(1));
- } else {
- parent_node.find('.span_value_variable').text(global_var.value[row][index]);
- }
- }
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
- global_var.value[row][index] = input_field.val();
- (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
- parent_node.find('.span_value_variable').text(global_var.value[row][index]);
- }
- input_field.off();
- input_field.remove(); /// update elements:
- opened_name_value_matrix_global_v = false;
- opened_input_value_matrix_global_v = false;
- }
- if (code == 27) {
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- parent_node.find('.span_value_variable').text(parseFloat(global_var.value[row][index]).toFixed(1));
- } else {
- parent_node.find('.span_value_variable').text(global_var.value[row][index]);
- }
- input_field.off();
- input_field.remove(); /// update elements:
- opened_name_value_matrix_global_v = false;
- opened_input_value_matrix_global_v = false;
- }
- });
- input_field.select();
- }
- var opened_name_value_global_var = false;
- var opened_input_value_global_ar = null;
- function enableGlobalValueUpdate(global_var, parent_node) {
- if (opened_name_value_global_var) {
- opened_input_value_global_ar.focus();
- return;
- }
- parent_node = $(parent_node);
- opened_name_value_global_var = true;
- parent_node.find('.span_value_variable').text('');
- var input_field;
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- 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) + "' />");
- input_field.insertBefore(parent_node.find('.span_value_variable'));
- } else {
- input_field = $("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value + "' />");
- input_field.insertBefore(parent_node.find('.span_value_variable'));
- }
- input_field.on('input', function () {
- var inputWidth = input_field.textWidth() + 10;
- opened_input_value_global_ar = input_field;
- input_field.focus();
- var tmpStr = input_field.val();
- input_field.val('');
- input_field.val(tmpStr);
- input_field.css({
- width: inputWidth
- });
- }).trigger('input');
- input_field.focusout(function () {
- var changed = false; /// update array:
- if (input_field.val().trim()) {
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- global_var.value = parseFloat(input_field.val().trim());
- parent_node.find('.span_value_variable').text(parseFloat(global_var.value).toFixed(1));
- } else {
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
- global_var.value = parseInt(input_field.val().trim());
- } else if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR) {
- global_var.value = input_field.val().charAt(0);
- } else {
- global_var.value = input_field.val().trim();
- }
- parent_node.find('.span_value_variable').text(global_var.value);
- }
- changed = true;
- } else {
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- parent_node.find('.span_value_variable').text(parseFloat(global_var.value).toFixed(1));
- } else {
- parent_node.find('.span_value_variable').text(global_var.value);
- }
- }
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
- global_var.value = input_field.val();
- changed = true;
- parent_node.find('.span_value_variable').text(global_var.value);
- }
- if (changed) {
- (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
- }
- input_field.off();
- input_field.remove(); /// update elements:
- opened_name_value_global_var = false;
- opened_input_value_global_ar = false;
- });
- input_field.on('keydown', function (e) {
- var code = e.keyCode || e.which;
- var changed = true;
- if (code == 13) {
- if (input_field.val().trim()) {
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- global_var.value = parseFloat(input_field.val().trim());
- parent_node.find('.span_value_variable').text(parseFloat(global_var.value).toFixed(1));
- } else {
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
- global_var.value = parseInt(input_field.val().trim());
- } else if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR) {
- global_var.value = input_field.val().charAt(0);
- } else {
- global_var.value = input_field.val().trim();
- }
- parent_node.find('.span_value_variable').text(global_var.value);
- }
- changed = true;
- } else {
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- parent_node.find('.span_value_variable').text(parseFloat(global_var.value).toFixed(1));
- } else {
- parent_node.find('.span_value_variable').text(global_var.value);
- }
- }
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
- global_var.value = input_field.val();
- changed = true;
- parent_node.find('.span_value_variable').text(global_var.value);
- }
- if (changed) {
- (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
- }
- input_field.off();
- input_field.remove(); /// update elements:
- opened_name_value_global_var = false;
- opened_input_value_global_ar = false;
- }
- if (code == 27) {
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- parent_node.find('.span_value_variable').text(parseFloat(global_var.value).toFixed(1));
- } else {
- parent_node.find('.span_value_variable').text(global_var.value);
- }
- input_field.off();
- input_field.remove(); /// update elements:
- opened_name_value_global_var = false;
- opened_input_value_global_ar = false;
- }
- });
- input_field.select();
- }
- var opened_name_global = false;
- var opened_input_global = null;
- function enableNameUpdate(global_container) {
- var global_var = global_container.data('associatedOject');
- if (opened_name_global) {
- opened_input_global.focus();
- return;
- }
- opened_name_global = true;
- global_container.find('.span_name_variable').text('');
- var input_name = $("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.name + "' />");
- input_name.insertBefore(global_container.find('.span_name_variable'));
- input_name.on('input', function () {
- var inputWidth = input_name.textWidth() + 10;
- opened_input_global = input_name;
- opened_input_global.focus();
- opened_input_global.css({
- width: inputWidth
- });
- }).trigger('input');
- input_name.focusout(function () {
- /// update array:
- if (input_name.val().trim().length > 0) {
- updateName(global_var, input_name.val().trim(), global_container);
- global_container.find('.span_name_variable').text(global_var.name);
- } else {
- global_container.find('.span_name_variable').text(global_var.name);
- }
- input_name.off();
- input_name.remove(); /// update elements:
- opened_name_global = false;
- opened_input_global = false;
- });
- input_name.on('keydown', function (e) {
- var code = e.keyCode || e.which;
- if (code == 13) {
- if (input_name.val().trim()) {
- updateName(global_var, input_name.val().trim(), global_container);
- global_container.find('.span_name_variable').text(global_var.name);
- } else {
- global_container.find('.span_name_variable').text(global_var.name);
- }
- input_name.off();
- input_name.remove(); /// update elements:
- opened_name_global = false;
- opened_input_global = false;
- }
- if (code == 27) {
- global_container.find('.span_name_variable').text(global_var.name);
- input_name.off();
- input_name.remove(); /// update elements:
- opened_name_global = false;
- opened_input_global = false;
- }
- });
- input_name.select();
- }
- var opened_name_value_vector_global_ = false;
- var opened_input_value_vector_global_ = null;
- function enableGlobalVectorValueUpdate(global_var, index, parent_node) {
- if (opened_name_value_vector_global_) {
- opened_input_value_vector_global_.focus();
- return;
- }
- parent_node = $(parent_node);
- opened_name_value_vector_global_ = true;
- parent_node.find('.span_value_variable').text('');
- var input_field;
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- 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) + "' />");
- input_field.insertBefore(parent_node.find('.span_value_variable'));
- } else {
- input_field = $("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value[index] + "' />");
- input_field.insertBefore(parent_node.find('.span_value_variable'));
- }
- input_field.on('input', function () {
- var inputWidth = input_field.textWidth() + 10;
- opened_input_value_vector_global_ = input_field;
- input_field.focus();
- var tmpStr = input_field.val();
- input_field.val('');
- input_field.val(tmpStr);
- input_field.css({
- width: inputWidth
- });
- }).trigger('input');
- input_field.focusout(function () {
- var changed = false; /// update array:
- if (input_field.val().trim()) {
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- global_var.value[index] = parseFloat(input_field.val().trim());
- parent_node.find('.span_value_variable').text(parseFloat(global_var.value[index]).toFixed(1));
- } else {
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
- global_var.value[index] = parseInt(input_field.val().trim());
- } else {
- global_var.value[index] = input_field.val().trim();
- }
- parent_node.find('.span_value_variable').text(global_var.value[index]);
- }
- changed = true;
- } else {
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- parent_node.find('.span_value_variable').text(parseFloat(global_var.value[index]).toFixed(1));
- } else {
- parent_node.find('.span_value_variable').text(global_var.value[index]);
- }
- }
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
- global_var.value[index] = input_field.val();
- changed = true;
- parent_node.find('.span_value_variable').text(global_var.value[index]);
- }
- if (changed) {
- (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
- }
- input_field.off();
- input_field.remove(); /// update elements:
- opened_name_value_vector_global_ = false;
- opened_input_value_vector_global_ = false;
- });
- input_field.on('keydown', function (e) {
- var code = e.keyCode || e.which;
- var changed = false;
- if (code == 13) {
- if (input_field.val().trim()) {
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- global_var.value[index] = parseFloat(input_field.val().trim());
- parent_node.find('.span_value_variable').text(parseFloat(global_var.value[index]).toFixed(1));
- } else {
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
- global_var.value[index] = parseInt(input_field.val().trim());
- } else {
- global_var.value[index] = input_field.val().trim();
- }
- parent_node.find('.span_value_variable').text(global_var.value[index]);
- }
- changed = true;
- } else {
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- parent_node.find('.span_value_variable').text(parseFloat(global_var.value[index]).toFixed(1));
- } else {
- parent_node.find('.span_value_variable').text(global_var.value[index]);
- }
- }
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
- global_var.value[index] = input_field.val();
- changed = true;
- parent_node.find('.span_value_variable').text(global_var.value[index]);
- }
- if (changed) {
- (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
- }
- input_field.off();
- input_field.remove(); /// update elements:
- opened_name_value_vector_global_ = false;
- opened_input_value_vector_global_ = false;
- }
- if (code == 27) {
- if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- parent_node.find('.span_value_variable').text(parseFloat(global_var.value[index]).toFixed(1));
- } else {
- parent_node.find('.span_value_variable').text(global_var.value[index]);
- }
- input_field.off();
- input_field.remove(); /// update elements:
- opened_name_value_vector_global_ = false;
- opened_input_value_vector_global_ = false;
- }
- });
- input_field.select();
- }
- $.fn.textWidth = function (text, font) {
- if (!$.fn.textWidth.fakeEl) $.fn.textWidth.fakeEl = $('<span>').hide().appendTo(document.body);
- $.fn.textWidth.fakeEl.text(text || this.val() || this.text() || this.attr('placeholder')).css('font', font || this.css('font'));
- return $.fn.textWidth.fakeEl.width();
- };
- /***/ }),
- /***/ "./js/visualUI/ivprog_elements.js":
- /*!****************************************!*\
- !*** ./js/visualUI/ivprog_elements.js ***!
- \****************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "COMMAND_TYPES": () => (/* binding */ COMMAND_TYPES),
- /* harmony export */ "ARITHMETIC_TYPES": () => (/* binding */ ARITHMETIC_TYPES),
- /* harmony export */ "EXPRESSION_ELEMENTS": () => (/* binding */ EXPRESSION_ELEMENTS),
- /* harmony export */ "EXPRESSION_TYPES": () => (/* binding */ EXPRESSION_TYPES),
- /* harmony export */ "ARITHMETIC_COMPARISON": () => (/* binding */ ARITHMETIC_COMPARISON),
- /* harmony export */ "LOGIC_COMPARISON": () => (/* binding */ LOGIC_COMPARISON),
- /* harmony export */ "SYSTEM_FUNCTIONS_CATEGORIES": () => (/* binding */ SYSTEM_FUNCTIONS_CATEGORIES),
- /* harmony export */ "Variable": () => (/* binding */ Variable),
- /* harmony export */ "Function": () => (/* binding */ Function),
- /* harmony export */ "SystemFunction": () => (/* binding */ SystemFunction),
- /* harmony export */ "Comment": () => (/* binding */ Comment),
- /* harmony export */ "Break": () => (/* binding */ Break),
- /* harmony export */ "Reader": () => (/* binding */ Reader),
- /* harmony export */ "Writer": () => (/* binding */ Writer),
- /* harmony export */ "Attribution": () => (/* binding */ Attribution),
- /* harmony export */ "ExpressionOperator": () => (/* binding */ ExpressionOperator),
- /* harmony export */ "ExpressionElement": () => (/* binding */ ExpressionElement),
- /* harmony export */ "ConditionalExpression": () => (/* binding */ ConditionalExpression),
- /* harmony export */ "LogicExpression": () => (/* binding */ LogicExpression),
- /* harmony export */ "ArithmeticExpression": () => (/* binding */ ArithmeticExpression),
- /* harmony export */ "IfTrue": () => (/* binding */ IfTrue),
- /* harmony export */ "RepeatNTimes": () => (/* binding */ RepeatNTimes),
- /* harmony export */ "WhileTrue": () => (/* binding */ WhileTrue),
- /* harmony export */ "DoWhileTrue": () => (/* binding */ DoWhileTrue),
- /* harmony export */ "Switch": () => (/* binding */ Switch),
- /* harmony export */ "Return": () => (/* binding */ Return),
- /* harmony export */ "SwitchCase": () => (/* binding */ SwitchCase),
- /* harmony export */ "FunctionCall": () => (/* binding */ FunctionCall),
- /* harmony export */ "VariableValueMenu": () => (/* binding */ VariableValueMenu),
- /* harmony export */ "FunctionCallMenu": () => (/* binding */ FunctionCallMenu),
- /* harmony export */ "Program": () => (/* binding */ Program)
- /* harmony export */ });
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
- /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
- /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(melanke_watchjs__WEBPACK_IMPORTED_MODULE_3__);
- /* harmony import */ var _algorithm__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./algorithm */ "./js/visualUI/algorithm.js");
- var COMMAND_TYPES = Object.freeze({
- "function": "function",
- comment: "comment",
- reader: "reader",
- writer: "writer",
- attribution: "attribution",
- iftrue: "iftrue",
- repeatNtimes: "repeatNtimes",
- whiletrue: "whiletrue",
- dowhiletrue: "dowhiletrue",
- "switch": "switch",
- switchcase: "switchcase",
- functioncall: "functioncall",
- "break": "break",
- "return": "return"
- });
- var ARITHMETIC_TYPES = Object.freeze({
- plus: "plus",
- minus: "minus",
- multiplication: "multiplication",
- division: "division",
- module: "module",
- none: "none"
- });
- var EXPRESSION_ELEMENTS = Object.freeze({
- exp_op_exp: "exp_op_exp",
- op_exp: "op_exp",
- par_exp_par: "par_exp_par",
- start_point: "start_point"
- });
- var EXPRESSION_TYPES = Object.freeze({
- exp_conditional: "exp_conditional",
- exp_logic: "exp_logic",
- exp_arithmetic: "exp_arithmetic",
- write_sep: "write_separator"
- });
- var ARITHMETIC_COMPARISON = Object.freeze({
- greater_than: "greater_than",
- less_than: "less_than",
- equals_to: "equals_to",
- not_equals_to: "not_equals_to",
- greater_than_or_equals_to: "greater_than_or_equals_to",
- less_than_or_equals_to: "less_than_or_equals_to"
- });
- var LOGIC_COMPARISON = Object.freeze({
- equals_to: "equals_to",
- not_equals_to: "not_equals_to",
- and: "and",
- or: "or",
- not: "not"
- });
- var SYSTEM_FUNCTIONS_CATEGORIES = Object.freeze({
- math: "$mathLib",
- text: "$strLib",
- arrangement: "$arrayLib",
- conversion: "$langLib"
- });
- var Variable = function Variable(type, name, value) {
- var dimensions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
- var is_constant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
- var rows = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
- var columns = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
- var reference = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, Variable);
- this.type = type;
- this.name = name;
- this.value = value;
- this.dimensions = dimensions;
- this.is_constant = is_constant;
- this.rows = rows;
- this.columns = columns;
- this.reference = reference;
- };
- var Function = function Function(name) {
- var return_type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _types__WEBPACK_IMPORTED_MODULE_2__.Types.VOID;
- var return_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
- var parameters_list = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
- var is_main = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
- var is_hidden = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
- var variables_list = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [];
- var function_comment = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
- var commands = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : [];
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, Function);
- this.type = COMMAND_TYPES["function"];
- this.name = name;
- this.return_type = return_type;
- this.return_dimensions = return_dimensions;
- this.parameters_list = parameters_list;
- this.is_main = is_main;
- this.is_hidden = is_hidden;
- this.variables_list = variables_list;
- this.function_comment = function_comment;
- this.commands = commands;
- };
- var SystemFunction = function SystemFunction(identifier, return_type, return_dimensions, parameters_list) {
- var function_comment = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
- var category = arguments.length > 5 ? arguments[5] : undefined;
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, SystemFunction);
- this.type = COMMAND_TYPES["function"];
- this.identifier = identifier;
- this.return_type = return_type;
- this.return_dimensions = return_dimensions;
- this.parameters_list = parameters_list;
- this.function_comment = function_comment;
- this.category = category;
- };
- var Comment = function Comment(comment_text) {
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, Comment);
- this.type = COMMAND_TYPES.comment;
- this.comment_text = comment_text;
- };
- var Break = function Break() {
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, Break);
- this.type = COMMAND_TYPES["break"];
- };
- var Reader = function Reader() {
- var variable_value_menu = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new VariableValueMenu();
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, Reader);
- this.type = COMMAND_TYPES.reader;
- this.variable_value_menu = variable_value_menu;
- };
- var Writer = function Writer(content) {
- var newline = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, Writer);
- this.type = COMMAND_TYPES.writer;
- this.content = content;
- this.newline = newline;
- };
- var Attribution = function Attribution(variable) {
- var expression = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, Attribution);
- this.type = COMMAND_TYPES.attribution;
- this.variable = variable;
- this.expression = expression;
- };
- var ExpressionOperator = function ExpressionOperator(type_op, item) {
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, ExpressionOperator);
- this.type_op = type_op; // Logic, Arithmetic OR Relational
- this.item = item;
- };
- var ExpressionElement = function ExpressionElement(type_exp) {
- var itens = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, ExpressionElement);
- this.type_exp = type_exp;
- this.itens = itens;
- };
- var ConditionalExpression = function ConditionalExpression(expression) {
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, ConditionalExpression);
- this.type = EXPRESSION_TYPES.exp_conditional;
- this.expression = expression;
- };
- var LogicExpression = function LogicExpression(has_neg, first_operand, second_operand, operator) {
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, LogicExpression);
- this.type = EXPRESSION_TYPES.exp_logic;
- this.has_neg = has_neg;
- this.first_operand = first_operand;
- this.second_operand = second_operand;
- this.operator = operator;
- };
- var ArithmeticExpression = function ArithmeticExpression(first_operand, second_operand, operator) {
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, ArithmeticExpression);
- this.type = EXPRESSION_TYPES.exp_arithmetic;
- this.first_operand = first_operand;
- this.second_operand = second_operand;
- this.operator = operator;
- };
- var IfTrue = function IfTrue(expression, commands_block, commands_else) {
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, IfTrue);
- this.type = COMMAND_TYPES.iftrue;
- this.expression = expression;
- this.commands_block = commands_block;
- this.commands_else = commands_else;
- };
- var RepeatNTimes = function RepeatNTimes(var_attribution, var_incrementation, expression1, expression2, expression3, commands_block) {
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, RepeatNTimes);
- this.type = COMMAND_TYPES.repeatNtimes;
- this.var_attribution = var_attribution;
- this.var_incrementation = var_incrementation;
- this.expression1 = expression1;
- this.expression2 = expression2;
- this.expression3 = expression3;
- this.commands_block = commands_block;
- };
- var WhileTrue = function WhileTrue(expression, commands_block) {
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, WhileTrue);
- this.type = COMMAND_TYPES.whiletrue;
- this.expression = expression;
- this.commands_block = commands_block;
- };
- var DoWhileTrue = function DoWhileTrue(expression, commands_block) {
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, DoWhileTrue);
- this.type = COMMAND_TYPES.dowhiletrue;
- this.expression = expression;
- this.commands_block = commands_block;
- };
- var Switch = function Switch(variable) {
- var cases = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, Switch);
- this.type = COMMAND_TYPES["switch"];
- this.variable = variable;
- this.cases = cases;
- };
- var Return = function Return(variable_value_menu) {
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, Return);
- this.type = COMMAND_TYPES["return"];
- this.variable_value_menu = variable_value_menu;
- };
- var SwitchCase = function SwitchCase(variable_value_menu) {
- var commands_block = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, SwitchCase);
- this.type = COMMAND_TYPES.switchcase;
- this.variable_value_menu = variable_value_menu;
- this.commands_block = commands_block;
- };
- var FunctionCall = function FunctionCall(function_called, parameters_list) {
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, FunctionCall);
- this.type = COMMAND_TYPES.functioncall;
- this.function_called = function_called;
- this.parameters_list = parameters_list;
- };
- var VariableValueMenu = function VariableValueMenu() {
- var variable_and_value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 7;
- var content = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
- var row = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
- var column = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
- var include_constant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
- var dimensions = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, VariableValueMenu);
- this.type = "var_value";
- this.variable_and_value = variable_and_value;
- this.content = content;
- this.row = row;
- this.column = column;
- this.include_constant = include_constant;
- this.dimensions = dimensions;
- };
- var FunctionCallMenu = function FunctionCallMenu() {
- var function_called = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
- var parameters_list = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, FunctionCallMenu);
- this.type = "function_call";
- this.function_called = function_called;
- this.parameters_list = parameters_list;
- };
- var Program = /*#__PURE__*/function () {
- function Program() {
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, Program);
- this.functions = [];
- this.globals = [];
- }
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_0___default()(Program, [{
- key: "addFunction",
- value: function addFunction(function_to_add) {
- melanke_watchjs__WEBPACK_IMPORTED_MODULE_3___default().watch(function_to_add.parameters_list, function () {
- if (window.insertContext) {
- setTimeout(function () {
- _algorithm__WEBPACK_IMPORTED_MODULE_4__.renderAlgorithm();
- }, 300);
- window.insertContext = false;
- } else {
- _algorithm__WEBPACK_IMPORTED_MODULE_4__.renderAlgorithm();
- }
- }, 1);
- melanke_watchjs__WEBPACK_IMPORTED_MODULE_3___default().watch(function_to_add.variables_list, function () {
- if (window.insertContext) {
- setTimeout(function () {
- _algorithm__WEBPACK_IMPORTED_MODULE_4__.renderAlgorithm();
- }, 300);
- window.insertContext = false;
- } else {
- _algorithm__WEBPACK_IMPORTED_MODULE_4__.renderAlgorithm();
- }
- }, 1);
- this.functions.push(function_to_add);
- }
- }, {
- key: "addVariable",
- value: function addVariable(function_to_receive, variable) {
- if (this.functions[function_to_receive].variable === null) {
- this.functions[function_to_receive].variables_list = [];
- }
- this.functions[function_to_receive].variables_list.push(variable);
- }
- }, {
- key: "addGlobal",
- value: function addGlobal(variable) {
- this.globals.push(variable);
- }
- }]);
- return Program;
- }();
- /***/ }),
- /***/ "./js/visualUI/text_editor.js":
- /*!************************************!*\
- !*** ./js/visualUI/text_editor.js ***!
- \************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "initTextEditor": () => (/* binding */ initTextEditor),
- /* harmony export */ "disable": () => (/* binding */ disable),
- /* harmony export */ "updateEditor": () => (/* binding */ updateEditor),
- /* harmony export */ "setCode": () => (/* binding */ setCode),
- /* harmony export */ "getCode": () => (/* binding */ getCode)
- /* harmony export */ });
- /* harmony import */ var codemirror__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! codemirror */ "./node_modules/codemirror/lib/codemirror.js");
- /* harmony import */ var codemirror__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(codemirror__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var codemirror_addon_edit_closebrackets__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! codemirror/addon/edit/closebrackets */ "./node_modules/codemirror/addon/edit/closebrackets.js");
- /* harmony import */ var codemirror_addon_edit_closebrackets__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(codemirror_addon_edit_closebrackets__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var codemirror_addon_edit_matchbrackets__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! codemirror/addon/edit/matchbrackets */ "./node_modules/codemirror/addon/edit/matchbrackets.js");
- /* harmony import */ var codemirror_addon_edit_matchbrackets__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(codemirror_addon_edit_matchbrackets__WEBPACK_IMPORTED_MODULE_2__);
- /* 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");
- /* 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__);
- /* harmony import */ var _util_editorMode2__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./../util/editorMode2 */ "./js/util/editorMode2.js");
- // import "codemirror/addon/hint/show-hint";
- // import "codemirror/addon/hint/anyword-hint";
- (0,_util_editorMode2__WEBPACK_IMPORTED_MODULE_4__.CodeEditorMode)(codemirror__WEBPACK_IMPORTED_MODULE_0__);
- var codeEditor = null;
- function initTextEditor(element) {
- var id = element;
- if (element[0] == '#') {
- id = element.substring(1);
- }
- codeEditor = codemirror__WEBPACK_IMPORTED_MODULE_0__.fromTextArea(document.getElementById(id), {
- theme: "ttcn",
- value: "",
- mode: "text/x-ivprog",
- indentUnit: 4,
- lineNumbers: true,
- matchBrackets: true,
- autoCloseBrackets: true,
- fixedGutter: true,
- styleActiveLine: true,
- readOnly: true
- });
- }
- function disable(flag) {
- codeEditor.setOption("readOnly", flag);
- updateEditor();
- }
- function updateEditor() {
- codeEditor.refresh();
- }
- function setCode(code) {
- codeEditor.setValue(code);
- }
- function getCode() {
- return codeEditor.getValue();
- }
- /***/ }),
- /***/ "./js/visualUI/types.js":
- /*!******************************!*\
- !*** ./js/visualUI/types.js ***!
- \******************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "Types": () => (/* binding */ Types)
- /* harmony export */ });
- var Types = Object.freeze({
- INTEGER: "integer",
- REAL: "real",
- TEXT: "text",
- CHAR: 'char',
- BOOLEAN: "boolean",
- VOID: "void"
- });
- /***/ }),
- /***/ "./js/visualUI/utils.js":
- /*!******************************!*\
- !*** ./js/visualUI/utils.js ***!
- \******************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "renderErrorMessage": () => (/* binding */ renderErrorMessage)
- /* harmony export */ });
- function renderErrorMessage(dom_obj_target, message_text) {
- dom_obj_target.popup({
- html: '<i class="ui icon inverted exclamation triangle yellow"></i>' + message_text,
- transition: "fade up",
- on: 'click',
- closable: true,
- movePopup: true,
- boundary: window,
- preserve: false,
- target: false,
- className: {
- popup: 'ui popup invalid-identifier'
- },
- onHidden: function onHidden($module) {
- dom_obj_target.popup('destroy');
- }
- }).popup('toggle');
- }
- /***/ }),
- /***/ "./js/visualUI/variables.js":
- /*!**********************************!*\
- !*** ./js/visualUI/variables.js ***!
- \**********************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "addVariable": () => (/* binding */ addVariable),
- /* harmony export */ "renderVariable": () => (/* binding */ renderVariable)
- /* harmony export */ });
- /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
- /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
- /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
- /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
- /* harmony import */ var _services_userLog__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./../services/userLog */ "./js/services/userLog.js");
- /* harmony import */ var _util_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./../util/utils */ "./js/util/utils.js");
- var counter_new_variables = 0;
- function addVariable(function_obj, function_container) {
- var is_in_click = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
- // Verify if the next variable name is in use:
- if (function_obj.variables_list) {
- var in_use = false;
- do {
- in_use = false;
- var temp_name = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('new_variable') + '_' + counter_new_variables;
- function_obj.variables_list.forEach(function (el) {
- if (temp_name == el.name) {
- in_use = true;
- }
- });
- if (in_use) counter_new_variables++;
- } while (in_use);
- }
- 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);
- if (function_obj.variables_list == null) {
- function_obj.variables_list = [];
- }
- function_obj.variables_list.push(new_var);
- counter_new_variables++;
- (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);
- var newe = renderVariable(function_container, new_var, function_obj);
- if (is_in_click) {
- newe.css('display', 'none');
- newe.fadeIn();
- }
- }
- function updateName(variable_obj, new_name, variable_obj_dom, function_obj) {
- if (variable_obj.name == new_name) {
- return;
- }
- if ((0,_util_utils__WEBPACK_IMPORTED_MODULE_5__.isValidIdentifier)(new_name)) {
- if (variableNameAlreadyExists(new_name, function_obj)) {
- _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]));
- } else {
- (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);
- variable_obj.name = new_name;
- }
- } else {
- _utils__WEBPACK_IMPORTED_MODULE_3__.renderErrorMessage(variable_obj_dom.find('.editing_name_var'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getError('inform_valid_identifier'));
- }
- }
- function variableNameAlreadyExists(name_var, function_obj) {
- if (function_obj.parameters_list) {
- for (var i = 0; i < function_obj.parameters_list.length; i++) {
- if (function_obj.parameters_list[i].name == name_var) {
- return true;
- }
- }
- }
- if (function_obj.variables_list) {
- for (var i = 0; i < function_obj.variables_list.length; i++) {
- if (function_obj.variables_list[i].name == name_var) {
- return true;
- }
- }
- }
- return false;
- }
- function removeVariable(variable_obj, variable_container, function_name) {
- var function_associated = variable_container.data('associatedFunction');
- (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(function_name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.REMOVE_FUNCTION_VAR, variable_obj.name);
- var index = function_associated.variables_list.indexOf(variable_obj);
- if (index > -1) {
- window.insertContext = true;
- delete function_associated.variables_list[index];
- function_associated.variables_list.splice(index, 1);
- }
- variable_container.children().off();
- variable_container.off();
- variable_container.fadeOut();
- }
- function updateType(variable_obj, new_type, function_name) {
- var new_dimensions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
- variable_obj.type = new_type;
- variable_obj.dimensions = new_dimensions;
- if (new_dimensions > 0) {
- variable_obj.rows = new_dimensions;
- variable_obj.columns = 2;
- }
- (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);
- updateInitialValues(variable_obj, function_name);
- }
- function addHandlers(variable_obj, variable_container, function_obj) {
- // Manage variable name:
- variable_container.find(".editing_name_var").on('click', function (e) {
- (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);
- enableNameUpdate(variable_obj, variable_container, function_obj);
- }); // Menu to change type:
- variable_container.find('.ui.dropdown.variable_type').dropdown({
- onChange: function onChange(_, __, $selectedItem) {
- if ($selectedItem.data('dimensions')) {
- updateType(variable_obj, _types__WEBPACK_IMPORTED_MODULE_0__.Types[$selectedItem.data('type')], function_obj.name, $selectedItem.data('dimensions'));
- } else {
- updateType(variable_obj, _types__WEBPACK_IMPORTED_MODULE_0__.Types[$selectedItem.data('type')], function_obj.name);
- }
- renderValues(variable_obj, variable_container, function_obj.name);
- },
- selectOnKeydown: false
- }); // Remove variable:
- variable_container.find(".remove_variable").on('click', function (e) {
- removeVariable(variable_obj, variable_container, function_obj.name);
- });
- variable_container.find(".ellipsis").popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_move_var"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- variable_container.find(".remove_variable").popup({
- content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_remove_var"),
- delay: {
- show: 750,
- hide: 0
- }
- });
- }
- function renderVariable(function_container, new_var, function_obj) {
- var element = '<div class="ui label variable_container pink"><i class="ui icon ellipsis vertical inverted"></i>';
- element += '<div class="ui dropdown variable_type">';
- if (new_var.dimensions == 1) {
- 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()));
- element += ' [ ] </div>';
- } else if (new_var.dimensions == 2) {
- 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()));
- element += ' [ ] [ ] </div>';
- } else {
- element += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_".concat(new_var.type.toLowerCase())) + '</div>';
- }
- element += '<div class="menu">';
- for (var tm in _types__WEBPACK_IMPORTED_MODULE_0__.Types) {
- if (tm == _types__WEBPACK_IMPORTED_MODULE_0__.Types.VOID.toUpperCase()) {
- continue;
- }
- 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>';
- }
- 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">';
- for (var tm in _types__WEBPACK_IMPORTED_MODULE_0__.Types) {
- if (tm == _types__WEBPACK_IMPORTED_MODULE_0__.Types.VOID.toUpperCase()) {
- continue;
- }
- 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>';
- }
- element += '</div></div>';
- 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">';
- for (var tm in _types__WEBPACK_IMPORTED_MODULE_0__.Types) {
- if (tm == _types__WEBPACK_IMPORTED_MODULE_0__.Types.VOID.toUpperCase()) {
- continue;
- }
- 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>';
- }
- element += '</div></div>';
- element += '</div></div> ';
- element += '<div class="editing_name_var"><span class="span_name_variable enable_edit_name_variable">' + new_var.name + '</span> </div>';
- element += ' <span class="character_equals"> <— </span> <div class="ui div_valor_var">' + new_var.value + '</div>';
- element += ' <i class="yellow inverted icon times remove_variable"></i></div>';
- element = $(element);
- element.data('associatedFunction', function_obj);
- function_container.find('.variables_list_div').append(element);
- addHandlers(new_var, element, function_obj);
- renderValues(new_var, element, function_obj.name);
- return element;
- }
- function updateColumnsAndRowsText(variable_container, variable_var) {
- var prev = variable_container.find('.text').text().split('[');
- if (prev.length == 2) {
- var ff = prev[0] + '[ ' + variable_var.columns + ' ] ';
- variable_container.find('.text').empty();
- variable_container.find('.text').text(ff);
- }
- if (prev.length == 3) {
- var ff = prev[0] + '[ ' + variable_var.columns + ' ] [ ' + variable_var.rows + ' ] ';
- variable_container.find('.text').empty();
- variable_container.find('.text').text(ff);
- }
- }
- function renderValues(new_var, variable_container, function_name) {
- var ret = "";
- var j = 0;
- if (new_var.dimensions == 0) {
- if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + new_var.value.toFixed(1) + '</span> </div> ';
- } else {
- if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
- 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> ';
- } else {
- ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + new_var.value + '</span> </div> ';
- }
- }
- } else {
- ret += '<table class="tabela_var">';
- if (new_var.dimensions == 1) {
- ret += '<tr>';
- if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- for (var k = 0; k < new_var.columns; k++) {
- ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + new_var.value[k].toFixed(1) + '</span></td>';
- }
- } else {
- for (var k = 0; k < new_var.columns; k++) {
- if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
- 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>';
- } else {
- ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + new_var.value[k] + '</span>' + '</td>';
- }
- }
- }
- ret += '</tr>';
- ret += '</table>';
- 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>';
- }
- if (new_var.dimensions == 2) {
- if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- for (var l = 0; l < new_var.rows; l++) {
- ret += '<tr>';
- for (var k = 0; k < new_var.columns; k++) {
- ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + new_var.value[l][k].toFixed(1) + '</span>' + '</td>';
- }
- ret += '</tr>';
- }
- } else {
- for (var l = 0; l < new_var.rows; l++) {
- ret += '<tr>';
- for (var k = 0; k < new_var.columns; k++) {
- if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
- 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>';
- } else {
- ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + new_var.value[l][k] + '</span></td>';
- }
- }
- ret += '</tr>';
- }
- }
- if (new_var.rows == 0) {
- ret += '<tr><td></td></tr>';
- }
- 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>';
- ret += '</table>';
- 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>';
- }
- }
- $(variable_container).find(".div_valor_var").html('');
- ret = $(ret);
- $(ret).find('.span_value_variable').data('associatedOject', new_var);
- $(ret).find(".boolean_simple_type").on('click', function (e) {
- (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);
- alternateBooleanValue(new_var, this.parentNode);
- });
- $(ret).find(".simple_var").on('click', function (e) {
- (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(function_name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.ENTER_CHANGE_VAR_VALUE, new_var.name);
- enableValueUpdate(new_var, this.parentNode, function_name);
- });
- $(ret).find(".boolean_vector_var").on('click', function (e) {
- alternateBooleanVectorValue(new_var, $(this).data('index'), this.parentNode);
- (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);
- });
- $(ret).find(".vector_var").on('click', function (e) {
- enableVectorValueUpdate(new_var, $(this).data('index'), this.parentNode, function_name);
- });
- $(ret).find(".remove_global_vector_column").on('click', function (e) {
- removeColumnVector(new_var);
- (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);
- (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);
- $(variable_container).find(".div_valor_var").html('');
- renderValues(new_var, variable_container, function_name);
- });
- $(ret).find(".add_global_vector_column").on('click', function (e) {
- addColumnVector(new_var);
- (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);
- (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);
- $(variable_container).find(".div_valor_var").html('');
- renderValues(new_var, variable_container, function_name);
- });
- $(ret).find(".remove_global_matrix_column").on('click', function (e) {
- removeColumnMatrix(new_var);
- (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);
- (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);
- $(variable_container).find(".div_valor_var").html('');
- renderValues(new_var, variable_container, function_name);
- });
- $(ret).find(".add_global_matrix_column").on('click', function (e) {
- addColumnMatrix(new_var);
- (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);
- (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);
- $(variable_container).find(".div_valor_var").html('');
- renderValues(new_var, variable_container, function_name);
- });
- $(ret).find(".remove_global_matrix_line").on('click', function (e) {
- removeLineMatrix(new_var);
- (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);
- (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);
- $(variable_container).find(".div_valor_var").html('');
- renderValues(new_var, variable_container, function_name);
- });
- $(ret).find(".add_global_matrix_line").on('click', function (e) {
- addLineMatrix(new_var);
- (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);
- (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);
- $(variable_container).find(".div_valor_var").html('');
- renderValues(new_var, variable_container, function_name);
- });
- $(ret).find(".boolean_matrix_var").on('click', function (e) {
- alternateBooleanMatrixValue(new_var, $(this).data('row'), $(this).data('index'), this.parentNode);
- (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);
- });
- $(ret).find(".matrix_var").on('click', function (e) {
- (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(function_name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.ENTER_CHANGE_VAR_VALUE, new_var.name);
- enableMatrixValueUpdate(new_var, $(this).data('row'), $(this).data('index'), this.parentNode, function_name);
- });
- $(variable_container).find(".div_valor_var").append(ret);
- updateColumnsAndRowsText(variable_container, new_var);
- }
- function alternateBooleanMatrixValue(var_obj, row, index, value_container) {
- var_obj.value[row][index] = !var_obj.value[row][index];
- $(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_".concat(var_obj.value[row][index])));
- }
- function addLineMatrix(var_obj) {
- var_obj.rows++;
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
- var n_l = [];
- for (var i = 0; i < var_obj.columns; i++) {
- n_l.push(0);
- }
- var_obj.value.push(n_l);
- }
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- var n_l = [];
- for (i = 0; i < var_obj.columns; i++) {
- n_l.push(0.0);
- }
- var_obj.value.push(n_l);
- }
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
- var n_l = [];
- for (i = 0; i < var_obj.columns; i++) {
- n_l.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('textvar_default_value'));
- }
- var_obj.value.push(n_l);
- }
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
- var n_l = [];
- for (i = 0; i < var_obj.columns; i++) {
- n_l.push(true);
- }
- var_obj.value.push(n_l);
- }
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR) {
- var n_l = [];
- for (i = 0; i < var_obj.columns; i++) {
- n_l.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('charvar_default_value'));
- }
- var_obj.value.push(n_l);
- }
- }
- function removeLineMatrix(var_obj) {
- if (var_obj.rows == 0) {
- return;
- }
- var_obj.rows--;
- var_obj.value.splice(var_obj.value.length - 1, 1);
- }
- function addColumnMatrix(var_obj) {
- var_obj.columns++;
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
- for (var i = 0; i < var_obj.rows; i++) {
- var_obj.value[i].push(0);
- }
- }
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- for (var i = 0; i < var_obj.rows; i++) {
- var_obj.value[i].push(0.0);
- }
- }
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
- for (var i = 0; i < var_obj.rows; i++) {
- var_obj.value[i].push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('textvar_default_value'));
- }
- }
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
- for (var i = 0; i < var_obj.rows; i++) {
- var_obj.value[i].push(true);
- }
- }
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR) {
- for (var i = 0; i < var_obj.rows; i++) {
- var_obj.value[i].push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('charvar_default_value'));
- }
- }
- }
- function removeColumnMatrix(var_obj) {
- if (var_obj.columns == 0) {
- return;
- }
- var_obj.columns--;
- for (var i = 0; i < var_obj.rows; i++) {
- var_obj.value[i].splice(var_obj.value[i].length - 1, 1);
- }
- }
- function addColumnVector(var_obj) {
- var_obj.columns++;
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
- var_obj.value.push(0);
- }
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- var_obj.value.push(0.0);
- }
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
- var_obj.value.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('textvar_default_value'));
- }
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
- var_obj.value.push(true);
- }
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR) {
- var_obj.value.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('charvar_default_value'));
- }
- }
- function removeColumnVector(var_obj) {
- if (var_obj.columns == 0) {
- return;
- }
- var_obj.columns--;
- var_obj.value.splice(var_obj.value.length - 1, 1);
- }
- function alternateBooleanValue(var_obj, value_container) {
- var_obj.value = !var_obj.value;
- $(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_".concat(var_obj.value)));
- }
- function alternateBooleanVectorValue(var_obj, index, value_container) {
- var_obj.value[index] = !var_obj.value[index];
- $(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_".concat(var_obj.value[index])));
- }
- function updateInitialValues(variable_obj, function_name) {
- if (variable_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
- if (variable_obj.dimensions == 0) {
- variable_obj.value = 0;
- }
- if (variable_obj.dimensions == 1) {
- variable_obj.value = [0, 0];
- }
- if (variable_obj.dimensions == 2) {
- variable_obj.value = [[0, 0], [0, 0]];
- }
- }
- if (variable_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- if (variable_obj.dimensions == 0) {
- variable_obj.value = 0.0;
- }
- if (variable_obj.dimensions == 1) {
- variable_obj.value = [0.0, 0.0];
- }
- if (variable_obj.dimensions == 2) {
- variable_obj.value = [[0.0, 0.0], [0.0, 0.0]];
- }
- }
- if (variable_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
- if (variable_obj.dimensions == 0) {
- variable_obj.value = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('textvar_default_value');
- }
- if (variable_obj.dimensions == 1) {
- 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')];
- }
- if (variable_obj.dimensions == 2) {
- 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')]];
- }
- }
- if (variable_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
- if (variable_obj.dimensions == 0) {
- variable_obj.value = true;
- }
- if (variable_obj.dimensions == 1) {
- variable_obj.value = [true, true];
- }
- if (variable_obj.dimensions == 2) {
- variable_obj.value = [[true, true], [true, true]];
- }
- }
- if (variable_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR) {
- if (variable_obj.dimensions == 0) {
- variable_obj.value = 'A';
- }
- if (variable_obj.dimensions == 1) {
- variable_obj.value = ['A', 'A'];
- }
- if (variable_obj.dimensions == 2) {
- variable_obj.value = [['A', 'A'], ['A', 'A']];
- }
- }
- (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);
- }
- var opened_name_value_vector_global_ = false;
- var opened_input_value_vector_global_ = null;
- function enableVectorValueUpdate(var_obj, index, parent_node, function_name) {
- if (opened_name_value_vector_global_) {
- opened_input_value_vector_global_.focus();
- return;
- }
- parent_node = $(parent_node);
- opened_name_value_vector_global_ = true;
- parent_node.find('.span_value_variable').text('');
- var input_field;
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- 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) + "' />");
- input_field.insertBefore(parent_node.find('.span_value_variable'));
- } else {
- input_field = $("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value[index] + "' />");
- input_field.insertBefore(parent_node.find('.span_value_variable'));
- }
- input_field.on('input', function () {
- var inputWidth = input_field.textWidth() + 10;
- opened_input_value_vector_global_ = input_field;
- input_field.focus();
- var tmpStr = input_field.val();
- input_field.val('');
- input_field.val(tmpStr);
- input_field.css({
- width: inputWidth
- });
- }).trigger('input');
- input_field.focusout(function () {
- var changed = false; /// update array:
- if (input_field.val().trim()) {
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- var_obj.value[index] = parseFloat(input_field.val().trim());
- parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
- } else {
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
- var_obj.value[index] = parseInt(input_field.val().trim());
- } else {
- var_obj.value[index] = input_field.val().trim();
- }
- parent_node.find('.span_value_variable').text(var_obj.value[index]);
- }
- changed = true;
- } else {
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
- } else {
- parent_node.find('.span_value_variable').text(var_obj.value[index]);
- }
- }
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
- var_obj.value[index] = input_field.val();
- changed = true;
- parent_node.find('.span_value_variable').text(var_obj.value[index]);
- }
- if (changed) {
- (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);
- }
- input_field.off();
- input_field.remove(); /// update elements:
- opened_name_value_vector_global_ = false;
- opened_input_value_vector_global_ = false;
- });
- input_field.on('keydown', function (e) {
- var code = e.keyCode || e.which;
- var changed = false;
- if (code == 13) {
- if (input_field.val().trim()) {
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- var_obj.value[index] = parseFloat(input_field.val().trim());
- parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
- } else {
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
- var_obj.value[index] = parseInt(input_field.val().trim());
- } else {
- var_obj.value[index] = input_field.val().trim();
- }
- parent_node.find('.span_value_variable').text(var_obj.value[index]);
- }
- changed = true;
- } else {
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
- } else {
- parent_node.find('.span_value_variable').text(var_obj.value[index]);
- }
- }
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
- var_obj.value[index] = input_field.val();
- changed = true;
- parent_node.find('.span_value_variable').text(var_obj.value[index]);
- }
- if (changed) {
- (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);
- }
- input_field.off();
- input_field.remove(); /// update elements:
- opened_name_value_vector_global_ = false;
- opened_input_value_vector_global_ = false;
- }
- if (code == 27) {
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
- } else {
- parent_node.find('.span_value_variable').text(var_obj.value[index]);
- }
- input_field.off();
- input_field.remove(); /// update elements:
- opened_name_value_vector_global_ = false;
- opened_input_value_vector_global_ = false;
- }
- });
- input_field.select();
- }
- var opened_name_value_global_var = false;
- var opened_input_value_global_ar = null;
- function enableValueUpdate(var_obj, parent_node, function_name) {
- if (opened_name_value_global_var) {
- opened_input_value_global_ar.focus();
- return;
- }
- parent_node = $(parent_node);
- opened_name_value_global_var = true;
- var input_field;
- parent_node.find('.span_value_variable').text('');
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- 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) + "' />");
- input_field.insertBefore(parent_node.find('.span_value_variable'));
- } else {
- input_field = $("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value + "' />");
- input_field.insertBefore(parent_node.find('.span_value_variable'));
- }
- input_field.on('input', function () {
- var inputWidth = input_field.textWidth() + 10;
- opened_input_value_global_ar = input_field;
- input_field.focus();
- var tmpStr = input_field.val();
- input_field.val('');
- input_field.val(tmpStr);
- input_field.css({
- width: inputWidth
- });
- }).trigger('input');
- input_field.focusout(function () {
- /// update array:
- var changed = false;
- if (input_field.val().trim()) {
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- var_obj.value = parseFloat(input_field.val().trim());
- parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
- } else {
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
- var_obj.value = parseInt(input_field.val().trim());
- } else if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR) {
- var_obj.value = input_field.val().charAt(0);
- } else {
- var_obj.value = input_field.val().trim();
- }
- parent_node.find('.span_value_variable').text(var_obj.value);
- }
- changed = true;
- } else {
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
- } else {
- parent_node.find('.span_value_variable').text(var_obj.value);
- }
- }
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
- var_obj.value = input_field.val();
- changed = true;
- parent_node.find('.span_value_variable').text(var_obj.value);
- }
- if (changed) {
- (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);
- }
- input_field.off();
- input_field.remove(); /// update elements:
- opened_name_value_global_var = false;
- opened_input_value_global_ar = false;
- });
- input_field.on('keydown', function (e) {
- var code = e.keyCode || e.which;
- var changed = false;
- if (code == 13) {
- if (input_field.val().trim()) {
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- var_obj.value = parseFloat(input_field.val().trim());
- parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
- } else {
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
- var_obj.value = parseInt(input_field.val().trim());
- } else if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR) {
- var_obj.value = input_field.val().charAt(0);
- } else {
- var_obj.value = input_field.val().trim();
- }
- parent_node.find('.span_value_variable').text(var_obj.value);
- }
- changed = true;
- } else {
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
- } else {
- parent_node.find('.span_value_variable').text(var_obj.value);
- }
- }
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
- var_obj.value = input_field.val();
- changed = true;
- parent_node.find('.span_value_variable').text(var_obj.value);
- }
- if (changed) {
- (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);
- }
- input_field.off();
- input_field.remove(); /// update elements:
- opened_name_value_global_var = false;
- opened_input_value_global_ar = false;
- }
- if (code == 27) {
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
- } else {
- parent_node.find('.span_value_variable').text(var_obj.value);
- }
- input_field.off();
- input_field.remove(); /// update elements:
- opened_name_value_global_var = false;
- opened_input_value_global_ar = false;
- }
- });
- input_field.select();
- }
- var opened_name_global = false;
- var opened_input_global = null;
- function enableNameUpdate(variable_obj, variable_container, function_obj) {
- if (opened_name_global) {
- opened_input_global.focus();
- return;
- }
- opened_name_global = true;
- variable_container.find('.span_name_variable').text('');
- var input_name;
- input_name = $("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + variable_obj.name + "' />");
- input_name.insertBefore(variable_container.find('.span_name_variable'));
- input_name.on('input', function () {
- var inputWidth = input_name.textWidth() + 10;
- opened_input_global = input_name;
- input_name.focus();
- var tmpStr = input_name.val();
- input_name.val('');
- input_name.val(tmpStr);
- input_name.css({
- width: inputWidth
- });
- }).trigger('input');
- input_name.focusout(function () {
- /// update array:
- if (input_name.val().trim().length > 0) {
- updateName(variable_obj, input_name.val().trim(), variable_container, function_obj);
- variable_container.find('.span_name_variable').text(variable_obj.name);
- } else {
- variable_container.find('.span_name_variable').text(variable_obj.name);
- }
- input_name.off();
- input_name.remove(); /// update elements:
- opened_name_global = false;
- opened_input_global = false;
- });
- input_name.on('keydown', function (e) {
- var code = e.keyCode || e.which;
- if (code == 13) {
- if (input_name.val().trim().length > 0) {
- updateName(variable_obj, input_name.val().trim(), variable_container, function_obj);
- variable_container.find('.span_name_variable').text(variable_obj.name);
- } else {
- variable_container.find('.span_name_variable').text(variable_obj.name);
- }
- input_name.off();
- input_name.remove(); /// update elements:
- opened_name_global = false;
- opened_input_global = false;
- }
- if (code == 27) {
- variable_container.find('.span_name_variable').text(variable_obj.name);
- input_name.off();
- input_name.remove(); /// update elements:
- opened_name_global = false;
- opened_input_global = false;
- }
- });
- input_name.select();
- }
- var opened_name_value_matrix_global_v = false;
- var opened_input_value_matrix_global_v = null;
- function enableMatrixValueUpdate(var_obj, row, index, parent_node, function_name) {
- if (opened_name_value_matrix_global_v) {
- opened_input_value_matrix_global_v.focus();
- return;
- }
- parent_node = $(parent_node);
- opened_name_value_matrix_global_v = true;
- parent_node.find('.span_value_variable').text('');
- var input_field;
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- 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) + "' />");
- input_field.insertBefore(parent_node.find('.span_value_variable'));
- } else {
- 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] + "' />");
- input_field.insertBefore(parent_node.find('.span_value_variable'));
- }
- input_field.on('input', function () {
- var inputWidth = input_field.textWidth() + 10;
- opened_input_value_matrix_global_v = input_field;
- input_field.focus();
- var tmpStr = input_field.val();
- input_field.val('');
- input_field.val(tmpStr);
- input_field.css({
- width: inputWidth
- });
- }).trigger('input');
- input_field.focusout(function () {
- var changed = false; /// update array:
- if (input_field.val().trim()) {
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- var_obj.value[row][index] = parseFloat(input_field.val().trim());
- parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
- } else {
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
- var_obj.value[row][index] = parseInt(input_field.val().trim());
- } else {
- var_obj.value[row][index] = input_field.val().trim();
- }
- parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
- }
- changed = true;
- } else {
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
- } else {
- parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
- }
- }
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
- var_obj.value[row][index] = input_field.val();
- changed = true;
- parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
- }
- if (changed) {
- (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);
- }
- input_field.off();
- input_field.remove(); /// update elements:
- opened_name_value_matrix_global_v = false;
- opened_input_value_matrix_global_v = false;
- });
- input_field.on('keydown', function (e) {
- var code = e.keyCode || e.which;
- var changed = false;
- if (code == 13) {
- if (input_field.val().trim()) {
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- var_obj.value[row][index] = parseFloat(input_field.val().trim());
- parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
- } else {
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
- var_obj.value[row][index] = parseInt(input_field.val().trim());
- } else {
- var_obj.value[row][index] = input_field.val().trim();
- }
- parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
- }
- changed = true;
- } else {
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
- } else {
- parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
- }
- }
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
- var_obj.value[row][index] = input_field.val();
- changed = true;
- parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
- }
- if (changed) {
- (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);
- }
- input_field.off();
- input_field.remove(); /// update elements:
- opened_name_value_matrix_global_v = false;
- opened_input_value_matrix_global_v = false;
- }
- if (code == 27) {
- if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
- parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
- } else {
- parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
- }
- input_field.off();
- input_field.remove(); /// update elements:
- opened_name_value_matrix_global_v = false;
- opened_input_value_matrix_global_v = false;
- }
- });
- input_field.select();
- }
- /***/ }),
- /***/ "./grammar/en/ivprog.ts":
- /*!******************************!*\
- !*** ./grammar/en/ivprog.ts ***!
- \******************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- "use strict";
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.enLexer = void 0;
- const lexer_1 = __webpack_require__(/*! ../lexer */ "./grammar/lexer.ts");
- // i18n lexer strings for the language.
- const types = {
- // types
- RK_REAL: "real",
- RK_INTEGER: "int",
- RK_BOOLEAN: "bool",
- RK_CHARACTER: "char",
- RK_STRING: "string",
- };
- const commands = {
- // RK_VOID is not formally part of Types since it doesn't have a valid value/instance
- RK_VOID: "vazio",
- // commands
- RK_PROGRAM: "program",
- RK_SWITCH: "switch",
- RK_CASE: "case",
- RK_DEFAULT: "otherwise",
- RK_CONST: "const",
- RK_FUNCTION: "function",
- RK_RETURN: "return",
- RK_FOR: "for",
- RK_FOR_ALT: "repeat_for",
- RK_FOR_FROM: "from",
- RK_FOR_TO: "to",
- RK_FOR_PASS: "pass",
- RK_BREAK: "break",
- RK_DO: "repeat",
- RK_DO_UNTIL: "until",
- RK_WHILE: "while",
- RK_WHILE_ALT: "repeat_while",
- RK_IF: "if",
- RK_ELSE: "else",
- RK_REFERENCE: "&",
- };
- const boolVal = {
- RK_FALSE: "false",
- RK_TRUE: "true",
- };
- const logicOp = {
- RK_LOGICAL_NOT: "not",
- RK_LOGICAL_AND: "AND",
- RK_LOGICAL_OR: "OR",
- };
- const langLibs = {
- $mathLib: "Mathematics",
- $ioLib: "IO",
- $strLib: "Text",
- $arrayLib: "Array",
- $langLib: "Conversion",
- };
- const langFuncs = {
- main_function: "main",
- $read: "read",
- $write: "write",
- $numElements: "total_of_elements",
- $matrixLines: "total_of_lines",
- $matrixColumns: "total_of_columns",
- $substring: "substring",
- $length: "length",
- $uppercase: "uppercase",
- $lowercase: "lowercase",
- $charAt: "char_at",
- $isReal: "is_real",
- $isInt: "is_integer",
- $isBool: "is_logic",
- $castReal: "to_real",
- $castInt: "to_integer",
- $castBool: "to_logic",
- $castString: "to_string",
- $castChar: "to_char",
- $sin: "sin",
- $cos: "cos",
- $tan: "tan",
- $sqrt: "sqrt",
- $pow: "pow",
- $log: "log",
- $abs: "abs",
- $negate: "negate",
- $invert: "invert",
- $max: "maximum",
- $min: "minimum",
- $rand: "random",
- };
- // END i18n lexer strings
- exports.enLexer = lexer_1.makeLexer({
- commands,
- boolVal,
- logicOp,
- types,
- langLibs,
- langFuncs,
- });
- /***/ }),
- /***/ "./grammar/helper.ts":
- /*!***************************!*\
- !*** ./grammar/helper.ts ***!
- \***************************/
- /***/ ((__unused_webpack_module, exports) => {
- "use strict";
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.combineRegex = void 0;
- function combineRegex(strings, ...pieces) {
- return new RegExp(strings.raw
- .map((r, i) => r + (pieces[i] === undefined ? "" : "(?:" + pieces[i].source + ")"))
- .join(""));
- }
- exports.combineRegex = combineRegex;
- /***/ }),
- /***/ "./grammar/index.ts":
- /*!**************************!*\
- !*** ./grammar/index.ts ***!
- \**************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- "use strict";
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- const ivprog_1 = __webpack_require__(/*! ./pt/ivprog */ "./grammar/pt/ivprog.ts");
- const ivprog_2 = __webpack_require__(/*! ./en/ivprog */ "./grammar/en/ivprog.ts");
- /*import * as ES from "./es/ivprog.g4";
- import ESFuncs from "./es/langFunctions";
- import ESLibs from "./es/langLibs";*/
- const lexers = {};
- lexers["pt"] = ivprog_1.ptLexer;
- lexers["en"] = ivprog_2.enLexer;
- exports["default"] = lexers;
- /***/ }),
- /***/ "./grammar/lexer.ts":
- /*!**************************!*\
- !*** ./grammar/lexer.ts ***!
- \**************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- "use strict";
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.makeLexer = exports.IVProgLexer = void 0;
- const moo = __webpack_require__(/*! moo */ "./node_modules/moo/moo.js");
- const helper_1 = __webpack_require__(/*! ./helper */ "./grammar/helper.ts");
- class IVProgLexer {
- constructor(RKs, lexer, rules, i18nLexer) {
- this.RKs = RKs;
- this.lexer = lexer;
- this.rules = rules;
- this.i18nLexer = i18nLexer;
- }
- getReservedKeys() {
- return this.RKs;
- }
- getRules() {
- return this.rules;
- }
- getTypeKeys() {
- return this.i18nLexer.types;
- }
- getLangLibs() {
- return this.i18nLexer.langLibs;
- }
- getLangFuncs() {
- return this.i18nLexer.langFuncs;
- }
- }
- exports.IVProgLexer = IVProgLexer;
- // General Regex Rules
- const ID = "[a-zA-Z_][a-zA-Z0-9_]*";
- const HEX_DIGIT = "[0-9a-fA-F]";
- const OCTAL_DIGIT = "[0-7]";
- const ESC_OCTAL = RegExp(`\\\\[0-3]${OCTAL_DIGIT}${OCTAL_DIGIT}|\\\\${OCTAL_DIGIT}${OCTAL_DIGIT}|\\\\${OCTAL_DIGIT}`);
- const ESC_UNICODE = RegExp(`\\\\u${HEX_DIGIT}${HEX_DIGIT}${HEX_DIGIT}${HEX_DIGIT}`);
- const ESC_SEQ_BASE = /\\[b,t,n,f,r,",',\\]|/;
- const ESC_SEQ = helper_1.combineRegex `${ESC_SEQ_BASE}|${ESC_UNICODE}|${ESC_OCTAL}`;
- const STRING_CHARACTER = helper_1.combineRegex `${ESC_SEQ}|[^"\\\\]`;
- function makeLexer(lexer) {
- const RKs = {};
- const rules = {};
- Object.entries(lexer.types).forEach(([key, value]) => {
- RKs[key] = value;
- rules[key] = key;
- });
- Object.entries(lexer.boolVal).forEach(([key, value]) => {
- RKs[key] = value;
- rules[key] = key;
- });
- Object.entries(lexer.commands).forEach(([key, value]) => {
- RKs[key] = value;
- rules[key] = key;
- });
- RKs["AND_OPERATOR"] = lexer.logicOp.RK_LOGICAL_AND;
- RKs["OR_OPERATOR"] = lexer.logicOp.RK_LOGICAL_OR;
- RKs["NOT_OPERATOR"] = lexer.logicOp.RK_LOGICAL_NOT;
- const RESERVED_KEYS = moo.keywords(RKs);
- const lexerRules = {
- COMMENTS: { match: /\/\/[^$]*?$|\/\*[^$]*?\*\//, lineBreaks: true },
- OPEN_BRACE: /\[/,
- CLOSE_BRACE: /\]/,
- OPEN_PARENTHESIS: /\(/,
- CLOSE_PARENTHESIS: /\)/,
- OPEN_CURLY: /\{/,
- CLOSE_CURLY: /\}/,
- COMMA: /,/,
- ASSIGNMENT: /<-|←/,
- REAL: /[0-9]+\.[0-9]*[eE][+-]?[0-9]+|[0-9]+\.[0-9]+/,
- INTEGER: RegExp(`(?:0x|0X)${HEX_DIGIT}+|(?:0b|0B)[0-1]+|[0-9]+`),
- SUM_OP: /[+-]/,
- MULTI_OP: /[*/%]/,
- RELATIONAL_OPERATOR: />=|==|<=|>|<|!=/,
- COLON: /:/,
- STRING: helper_1.combineRegex `"(?:${STRING_CHARACTER})*?"`,
- CHARACTER: helper_1.combineRegex `'(?:${ESC_SEQ}|[^'\\\\])'`,
- EOS: { match: /;\r?\n?|[\r\n]+/, lineBreaks: true },
- WHITESPACE: /(?: |\t)+/,
- RK_REFERENCE: RegExp(lexer.commands.RK_REFERENCE),
- ID: { match: RegExp(ID), type: RESERVED_KEYS },
- DOT: /\./,
- ERROR: { match: /[\$?`]/, error: true },
- };
- Object.entries(lexerRules).forEach(([key, _]) => (rules[key] = key));
- const moolexer = moo.compile(lexerRules);
- return new IVProgLexer(RKs, moolexer, rules, lexer);
- }
- exports.makeLexer = makeLexer;
- /***/ }),
- /***/ "./grammar/pt/ivprog.ts":
- /*!******************************!*\
- !*** ./grammar/pt/ivprog.ts ***!
- \******************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- "use strict";
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.ptLexer = void 0;
- const lexer_1 = __webpack_require__(/*! ../lexer */ "./grammar/lexer.ts");
- // i18n lexer strings for the language.
- const types = {
- // types
- RK_REAL: "real",
- RK_INTEGER: "inteiro",
- RK_BOOLEAN: "logico",
- RK_CHARACTER: "caractere",
- RK_STRING: "cadeia",
- };
- const commands = {
- // RK_VOID is not formally part of Types since it doesn't have a valid value/instance
- RK_VOID: "vazio",
- // commands
- RK_PROGRAM: "programa",
- RK_SWITCH: "escolha",
- RK_CASE: "caso",
- RK_DEFAULT: "contrario",
- RK_CONST: "const",
- RK_FUNCTION: "funcao",
- RK_RETURN: "devolva",
- RK_FOR: "para",
- RK_FOR_ALT: "repita_para",
- RK_FOR_FROM: "de",
- RK_FOR_TO: "ate",
- RK_FOR_PASS: "passo",
- RK_BREAK: "pare",
- RK_DO: "repita",
- RK_DO_UNTIL: "ate_que",
- RK_WHILE: "enquanto",
- RK_WHILE_ALT: "repita_enquanto",
- RK_IF: "se",
- RK_ELSE: "senao",
- RK_REFERENCE: "&",
- };
- const boolVal = {
- RK_FALSE: "falso",
- RK_TRUE: "verdadeiro",
- };
- const logicOp = {
- RK_LOGICAL_NOT: "nao",
- RK_LOGICAL_AND: "E",
- RK_LOGICAL_OR: "OU",
- };
- const langLibs = {
- $mathLib: "Matematica",
- $ioLib: "ES",
- $strLib: "Texto",
- $arrayLib: "Arranjo",
- $langLib: "Conversao",
- };
- const langFuncs = {
- main_function: "inicio",
- $read: "leia",
- $write: "escreva",
- $numElements: "total_de_elementos",
- $matrixLines: "total_de_linhas",
- $matrixColumns: "total_de_colunas",
- $substring: "subcadeia",
- $length: "comprimento",
- $uppercase: "caixa_alta",
- $lowercase: "caixa_baixa",
- $charAt: "caractere_na_posicao",
- $isReal: "e_real",
- $isInt: "e_inteiro",
- $isBool: "e_logico",
- $castReal: "como_real",
- $castInt: "como_inteiro",
- $castBool: "como_logico",
- $castString: "como_cadeia",
- $castChar: "como_caractere",
- $sin: "seno",
- $cos: "cosseno",
- $tan: "tangente",
- $sqrt: "raiz_quadrada",
- $pow: "potencia",
- $log: "logaritmo",
- $abs: "modulo",
- $negate: "trocar_sinal",
- $invert: "inverter_valor",
- $max: "maximo",
- $min: "minimo",
- $rand: "numero_aleatorio",
- };
- // END i18n lexer strings
- exports.ptLexer = lexer_1.makeLexer({
- commands,
- boolVal,
- logicOp,
- types,
- langLibs,
- langFuncs,
- });
- /***/ }),
- /***/ "./i18n/index.ts":
- /*!***********************!*\
- !*** ./i18n/index.ts ***!
- \***********************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- "use strict";
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- const Messages = __webpack_require__(/*! ./message.csv */ "./i18n/message.csv");
- const UI = __webpack_require__(/*! ./ui.csv */ "./i18n/ui.csv");
- const Errors = __webpack_require__(/*! ./error.csv */ "./i18n/error.csv");
- const MessagesObj = Messages;
- const UIObj = UI;
- const ErrorsObj = Errors;
- const i18n_data = {};
- for (const key in UIObj) {
- const data = {};
- data['error'] = ErrorsObj[key];
- data['message'] = MessagesObj[key];
- data['ui'] = UIObj[key];
- i18n_data[key] = data;
- }
- exports["default"] = i18n_data;
- /***/ }),
- /***/ "./js/ast/operators.ts":
- /*!*****************************!*\
- !*** ./js/ast/operators.ts ***!
- \*****************************/
- /***/ ((__unused_webpack_module, exports) => {
- "use strict";
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.convertFromString = exports.Operators = void 0;
- exports.Operators = Object.freeze({
- ADD: { ord: 0, value: "+" },
- SUB: { ord: 1, value: "-" },
- MULT: { ord: 2, value: '*' },
- DIV: { ord: 3, value: '/' },
- MOD: { ord: 4, value: '%' },
- GT: { ord: 5, value: '>' },
- GE: { ord: 6, value: '>=' },
- LT: { ord: 7, value: '<' },
- LE: { ord: 8, value: '<=' },
- EQ: { ord: 9, value: '==' },
- NEQ: { ord: 10, value: '!=' },
- AND: { ord: 11, value: 'and' },
- OR: { ord: 12, value: 'or' },
- NOT: { ord: 13, value: 'not' }
- });
- function convertFromString(op) {
- switch (op) {
- case '+': return exports.Operators.ADD;
- case '-': return exports.Operators.SUB;
- case '*': return exports.Operators.MULT;
- case '/': return exports.Operators.DIV;
- case '%': return exports.Operators.MOD;
- case '>': return exports.Operators.GT;
- case '>=': return exports.Operators.GE;
- case '<': return exports.Operators.LT;
- case '<=': return exports.Operators.LE;
- case '==': return exports.Operators.EQ;
- case '!=': return exports.Operators.NEQ;
- case 'and': return exports.Operators.AND;
- case 'or': return exports.Operators.OR;
- case 'not': return exports.Operators.NOT;
- }
- return null;
- }
- exports.convertFromString = convertFromString;
- /***/ }),
- /***/ "./js/memory/address.ts":
- /*!******************************!*\
- !*** ./js/memory/address.ts ***!
- \******************************/
- /***/ ((__unused_webpack_module, exports) => {
- "use strict";
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.Address = void 0;
- class Address {
- /**
- *
- * @param {Number} id the address id
- * @param {never} value the value stored at this address
- */
- constructor(id, value) {
- this.id = id;
- this.value = value;
- }
- }
- exports.Address = Address;
- /***/ }),
- /***/ "./js/memory/location.ts":
- /*!*******************************!*\
- !*** ./js/memory/location.ts ***!
- \*******************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- "use strict";
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.Location = void 0;
- const address_1 = __webpack_require__(/*! ./address */ "./js/memory/address.ts");
- class LocationHolder {
- constructor() {
- this.data = [];
- this.address_id = 0;
- }
- /**
- *
- * @param {never} value the value to be allocated
- * @returns {number} - the address id
- */
- allocate(value) {
- const id = this.address_id;
- // console.log("Allocation address "+ id);
- const address = new address_1.Address(id, value);
- this.data.push(address);
- this.address_id += 1;
- return id;
- }
- /**
- *
- * @param {number} id
- */
- deallocate(id) {
- const index = this.findIndex(id);
- // console.log("Deallocation address "+ id);
- if (index !== -1) {
- this.data.splice(index, 1);
- return true;
- }
- return false;
- }
- /**
- *
- * @param {number} id
- * @returns {Address} the address identified by id
- */
- find(id) {
- let beg = 0;
- let end = this.data.length;
- // console.log("Finding address "+id);
- while (beg < end) {
- const med = Math.floor((beg + end) / 2);
- const address = this.getAddressAt(med);
- if (address.id === id) {
- return address;
- }
- else if (id > address.id) {
- beg = med;
- }
- else {
- end = med;
- }
- }
- return undefined;
- }
- getAddressAt(pos) {
- return this.data[pos];
- }
- /**
- *
- * @param {number} id address id
- * @returns {number} the index of the address identified by id
- */
- findIndex(id) {
- let beg = 0;
- let end = this.data.length;
- while (beg < end) {
- const med = Math.floor((beg + end) / 2);
- const address = this.getAddressAt(med);
- if (address.id === id) {
- return med;
- }
- else if (id > address.id) {
- beg = med;
- }
- else {
- end = med;
- }
- }
- return -1;
- }
- updateAddress(id, value) {
- const index = this.findIndex(id);
- if (index === -1) {
- throw new Error("Invalid address..." + id);
- }
- this.data[index].value = value;
- }
- clear() {
- for (let i = 0; i < this.data.length; i += 1) {
- delete this.data[i];
- }
- this.data = [];
- this.address_id = 0;
- }
- }
- const inner_ref = new LocationHolder();
- exports.Location = Object.freeze({
- allocate: inner_ref.allocate.bind(inner_ref),
- deallocate: inner_ref.deallocate.bind(inner_ref),
- find: inner_ref.find.bind(inner_ref),
- updateAddress: inner_ref.updateAddress.bind(inner_ref),
- clear: inner_ref.clear.bind(inner_ref),
- size: () => inner_ref.data.length
- });
- /***/ }),
- /***/ "./js/processor/compatibilityTable.ts":
- /*!********************************************!*\
- !*** ./js/processor/compatibilityTable.ts ***!
- \********************************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- "use strict";
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.resultTypeAfterUnaryOp = exports.resultTypeAfterInfixOp = void 0;
- const types_1 = __webpack_require__(/*! ../typeSystem/types */ "./js/typeSystem/types.ts");
- const operators_1 = __webpack_require__(/*! ../ast/operators */ "./js/ast/operators.ts");
- const multiType_1 = __webpack_require__(/*! ../typeSystem/multiType */ "./js/typeSystem/multiType.ts");
- const config_1 = __webpack_require__(/*! ../util/config */ "./js/util/config.ts");
- function buildInfixAddTable() {
- const table = [[], [], [], [], []];
- table[types_1.Types.INTEGER.ord][types_1.Types.INTEGER.ord] = types_1.Types.INTEGER;
- table[types_1.Types.INTEGER.ord][types_1.Types.REAL.ord] = types_1.Types.REAL;
- table[types_1.Types.INTEGER.ord][types_1.Types.STRING.ord] = types_1.Types.STRING;
- table[types_1.Types.REAL.ord][types_1.Types.INTEGER.ord] = types_1.Types.REAL;
- table[types_1.Types.REAL.ord][types_1.Types.REAL.ord] = types_1.Types.REAL;
- table[types_1.Types.REAL.ord][types_1.Types.STRING.ord] = types_1.Types.STRING;
- table[types_1.Types.STRING.ord][types_1.Types.INTEGER.ord] = types_1.Types.STRING;
- table[types_1.Types.STRING.ord][types_1.Types.REAL.ord] = types_1.Types.STRING;
- table[types_1.Types.STRING.ord][types_1.Types.STRING.ord] = types_1.Types.STRING;
- table[types_1.Types.STRING.ord][types_1.Types.BOOLEAN.ord] = types_1.Types.STRING;
- table[types_1.Types.STRING.ord][types_1.Types.CHAR.ord] = types_1.Types.STRING;
- table[types_1.Types.CHAR.ord][types_1.Types.CHAR.ord] = types_1.Types.STRING;
- table[types_1.Types.CHAR.ord][types_1.Types.STRING.ord] = types_1.Types.STRING;
- return table;
- }
- function buildInfixMultiDivSubTable() {
- const table = [[], []];
- table[types_1.Types.INTEGER.ord][types_1.Types.INTEGER.ord] = types_1.Types.INTEGER;
- table[types_1.Types.INTEGER.ord][types_1.Types.REAL.ord] = types_1.Types.REAL;
- table[types_1.Types.REAL.ord][types_1.Types.INTEGER.ord] = types_1.Types.REAL;
- table[types_1.Types.REAL.ord][types_1.Types.REAL.ord] = types_1.Types.REAL;
- return table;
- }
- function buildInfixEqualityInequalityTable() {
- const table = [[], [], [], [], []];
- table[types_1.Types.INTEGER.ord][types_1.Types.INTEGER.ord] = types_1.Types.BOOLEAN;
- table[types_1.Types.REAL.ord][types_1.Types.REAL.ord] = types_1.Types.BOOLEAN;
- table[types_1.Types.BOOLEAN.ord][types_1.Types.BOOLEAN.ord] = types_1.Types.BOOLEAN;
- table[types_1.Types.STRING.ord][types_1.Types.STRING.ord] = types_1.Types.BOOLEAN;
- table[types_1.Types.CHAR.ord][types_1.Types.CHAR.ord] = types_1.Types.BOOLEAN;
- return table;
- }
- function buildInfixRelationalTable() {
- const table = [[], [], [], [], []];
- table[types_1.Types.INTEGER.ord][types_1.Types.INTEGER.ord] = types_1.Types.BOOLEAN;
- table[types_1.Types.REAL.ord][types_1.Types.REAL.ord] = types_1.Types.BOOLEAN;
- table[types_1.Types.STRING.ord][types_1.Types.STRING.ord] = types_1.Types.BOOLEAN;
- table[types_1.Types.CHAR.ord][types_1.Types.CHAR.ord] = types_1.Types.BOOLEAN;
- return table;
- }
- function buildInfixAndOrTable() {
- const table = [[], [], [], []];
- table[types_1.Types.BOOLEAN.ord][types_1.Types.BOOLEAN.ord] = types_1.Types.BOOLEAN;
- return table;
- }
- function buildInfixModTable() {
- const table = [[]];
- table[types_1.Types.INTEGER.ord][types_1.Types.INTEGER.ord] = types_1.Types.INTEGER;
- return table;
- }
- function buildUnarySumSubList() {
- const list = [];
- list[types_1.Types.INTEGER.ord] = types_1.Types.INTEGER;
- list[types_1.Types.REAL.ord] = types_1.Types.REAL;
- return list;
- }
- function buildUnaryNegList() {
- const list = [];
- list[types_1.Types.BOOLEAN.ord] = types_1.Types.BOOLEAN;
- return list;
- }
- function buildInfixCompatibilityTable() {
- const compatibilityMap = new WeakMap();
- compatibilityMap.set(operators_1.Operators.ADD, buildInfixAddTable());
- compatibilityMap.set(operators_1.Operators.SUB, buildInfixMultiDivSubTable());
- compatibilityMap.set(operators_1.Operators.MULT, buildInfixMultiDivSubTable());
- compatibilityMap.set(operators_1.Operators.DIV, buildInfixMultiDivSubTable());
- compatibilityMap.set(operators_1.Operators.EQ, buildInfixEqualityInequalityTable());
- compatibilityMap.set(operators_1.Operators.NEQ, buildInfixEqualityInequalityTable());
- compatibilityMap.set(operators_1.Operators.GE, buildInfixRelationalTable());
- compatibilityMap.set(operators_1.Operators.GT, buildInfixRelationalTable());
- compatibilityMap.set(operators_1.Operators.LE, buildInfixRelationalTable());
- compatibilityMap.set(operators_1.Operators.LT, buildInfixRelationalTable());
- compatibilityMap.set(operators_1.Operators.OR, buildInfixAndOrTable());
- compatibilityMap.set(operators_1.Operators.AND, buildInfixAndOrTable());
- compatibilityMap.set(operators_1.Operators.MOD, buildInfixModTable());
- return compatibilityMap;
- }
- function buildUnaryCompatibilityTable() {
- const compatibilityMap = new WeakMap();
- compatibilityMap.set(operators_1.Operators.ADD, buildUnarySumSubList());
- compatibilityMap.set(operators_1.Operators.SUB, buildUnarySumSubList());
- compatibilityMap.set(operators_1.Operators.NOT, buildUnaryNegList());
- return compatibilityMap;
- }
- const infixMap = buildInfixCompatibilityTable();
- const unaryMap = buildUnaryCompatibilityTable();
- function resultTypeAfterInfixOp(operator, leftExpressionType, rightExpressionType) {
- try {
- if (leftExpressionType instanceof multiType_1.MultiType && rightExpressionType instanceof multiType_1.MultiType) {
- let newMulti = [];
- for (let i = 0; i < leftExpressionType.types.length; ++i) {
- const typeA = leftExpressionType.types[i];
- for (let j = 0; j < rightExpressionType.types.length; ++i) {
- const typeB = rightExpressionType.types[j];
- newMulti.push(resultTypeAfterInfixOp(operator, typeA, typeB));
- }
- }
- newMulti = newMulti.filter(x => !x.isCompatible(types_1.Types.UNDEFINED));
- if (newMulti.length <= 0) {
- if (config_1.Config.enable_type_casting) {
- if (leftExpressionType.isCompatible(types_1.Types.INTEGER) || leftExpressionType.isCompatible(types_1.Types.REAL)) {
- if (rightExpressionType.isCompatible(types_1.Types.INTEGER) || rightExpressionType.isCompatible(types_1.Types.REAL)) {
- return new multiType_1.MultiType([types_1.Types.INTEGER, types_1.Types.REAL]);
- }
- }
- }
- return types_1.Types.UNDEFINED;
- }
- else {
- return new multiType_1.MultiType(newMulti);
- }
- }
- else if (leftExpressionType instanceof multiType_1.MultiType) {
- if (leftExpressionType.isCompatible(rightExpressionType)) {
- return resultTypeAfterInfixOp(operator, rightExpressionType, rightExpressionType);
- }
- else {
- if (config_1.Config.enable_type_casting) {
- if (leftExpressionType.isCompatible(types_1.Types.INTEGER) || leftExpressionType.isCompatible(types_1.Types.REAL)) {
- if (rightExpressionType.isCompatible(types_1.Types.INTEGER) || rightExpressionType.isCompatible(types_1.Types.REAL)) {
- return rightExpressionType;
- }
- }
- }
- return types_1.Types.UNDEFINED;
- }
- }
- else if (rightExpressionType instanceof multiType_1.MultiType) {
- if (rightExpressionType.isCompatible(leftExpressionType)) {
- return resultTypeAfterInfixOp(operator, leftExpressionType, leftExpressionType);
- }
- else {
- if (config_1.Config.enable_type_casting) {
- if (leftExpressionType.isCompatible(types_1.Types.INTEGER) || leftExpressionType.isCompatible(types_1.Types.REAL)) {
- if (rightExpressionType.isCompatible(types_1.Types.INTEGER) || rightExpressionType.isCompatible(types_1.Types.REAL)) {
- return leftExpressionType;
- }
- }
- }
- return types_1.Types.UNDEFINED;
- }
- }
- const resultTable = infixMap.get(operator) || [];
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- const resultType = resultTable[leftExpressionType.ord][rightExpressionType.ord];
- if (resultType === null || resultType === undefined) {
- if (config_1.Config.enable_type_casting) {
- if (leftExpressionType.isCompatible(types_1.Types.INTEGER) || leftExpressionType.isCompatible(types_1.Types.REAL)) {
- if (rightExpressionType.isCompatible(types_1.Types.INTEGER) || rightExpressionType.isCompatible(types_1.Types.REAL)) {
- if (operator === operators_1.Operators.MOD) {
- return types_1.Types.INTEGER;
- }
- else if (operator.ord >= 5 && operator.ord <= 10) {
- return types_1.Types.BOOLEAN;
- }
- }
- }
- }
- return types_1.Types.UNDEFINED;
- }
- return resultType;
- }
- catch (e) {
- if (e instanceof TypeError) {
- return types_1.Types.UNDEFINED;
- }
- else {
- throw e;
- }
- }
- }
- exports.resultTypeAfterInfixOp = resultTypeAfterInfixOp;
- function resultTypeAfterUnaryOp(operator, leftExpressionType) {
- try {
- if (leftExpressionType instanceof multiType_1.MultiType) {
- let newMulti = [];
- for (let i = 0; i < leftExpressionType.types.length; ++i) {
- const type = leftExpressionType.types[i];
- newMulti.push(resultTypeAfterUnaryOp(operator, type));
- }
- newMulti = newMulti.filter(x => !x.isCompatible(types_1.Types.UNDEFINED));
- if (newMulti.length <= 0) {
- return types_1.Types.UNDEFINED;
- }
- return new multiType_1.MultiType(newMulti);
- }
- const resultTable = unaryMap.get(operator) || [];
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- const resultType = resultTable[leftExpressionType.ord];
- if (resultType == null) {
- return types_1.Types.UNDEFINED;
- }
- return resultType;
- }
- catch (e) {
- if (e instanceof TypeError) {
- return types_1.Types.UNDEFINED;
- }
- else {
- throw e;
- }
- }
- }
- exports.resultTypeAfterUnaryOp = resultTypeAfterUnaryOp;
- /***/ }),
- /***/ "./js/processor/context.ts":
- /*!*********************************!*\
- !*** ./js/processor/context.ts ***!
- \*********************************/
- /***/ ((__unused_webpack_module, exports) => {
- "use strict";
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.Context = void 0;
- exports.Context = Object.freeze({
- BASE: Symbol('context:base'),
- BREAKABLE: Symbol('context:breakable'),
- FUNCTION: Symbol('context:function')
- });
- /***/ }),
- /***/ "./js/processor/modes.ts":
- /*!*******************************!*\
- !*** ./js/processor/modes.ts ***!
- \*******************************/
- /***/ ((__unused_webpack_module, exports) => {
- "use strict";
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.Modes = void 0;
- exports.Modes = Object.freeze({
- RETURN: Symbol('mode:return'),
- BREAK: Symbol('mode:break'),
- PAUSE: Symbol('mode:pause'),
- RUN: Symbol('mode:run'),
- ABORT: Symbol('mode:abort')
- });
- /***/ }),
- /***/ "./js/processor/store/store.ts":
- /*!*************************************!*\
- !*** ./js/processor/store/store.ts ***!
- \*************************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- "use strict";
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.Store = void 0;
- /* eslint-disable @typescript-eslint/no-non-null-assertion */
- const modes_1 = __webpack_require__(/*! ../modes */ "./js/processor/modes.ts");
- const types_1 = __webpack_require__(/*! ../../typeSystem/types */ "./js/typeSystem/types.ts");
- const storeObject_1 = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.ts");
- const storeObjectRef_1 = __webpack_require__(/*! ./storeObjectRef */ "./js/processor/store/storeObjectRef.ts");
- const array_type_1 = __webpack_require__(/*! ../../typeSystem/array_type */ "./js/typeSystem/array_type.ts");
- const array_store_value_1 = __webpack_require__(/*! ./value/array_store_value */ "./js/processor/store/value/array_store_value.ts");
- const location_1 = __webpack_require__(/*! ../../memory/location */ "./js/memory/location.ts");
- const storeObjectArray_1 = __webpack_require__(/*! ./storeObjectArray */ "./js/processor/store/storeObjectArray.ts");
- const store_value_1 = __webpack_require__(/*! ./value/store_value */ "./js/processor/store/value/store_value.ts");
- const store_value_address_1 = __webpack_require__(/*! ./value/store_value_address */ "./js/processor/store/value/store_value_address.ts");
- const store_value_ref_1 = __webpack_require__(/*! ./value/store_value_ref */ "./js/processor/store/value/store_value_ref.ts");
- const array_store_value_ref_1 = __webpack_require__(/*! ./value/array_store_value_ref */ "./js/processor/store/value/array_store_value_ref.ts");
- const store_object_array_ref_1 = __webpack_require__(/*! ./store_object_array_ref */ "./js/processor/store/store_object_array_ref.ts");
- class Store {
- constructor(name) {
- this.name = name;
- this.store = new Map();
- this.mode = modes_1.Modes.RUN;
- }
- static canImplicitTypeCast(castType, sourceType) {
- if (castType.isCompatible(types_1.Types.INTEGER) || castType.isCompatible(types_1.Types.REAL)) {
- if (sourceType.isCompatible(types_1.Types.INTEGER) || sourceType.isCompatible(types_1.Types.REAL)) {
- return true;
- }
- }
- return false;
- }
- static doImplicitCasting(castType, stoObj) {
- if (!Store.canImplicitTypeCast(castType, stoObj.type)) {
- throw new Error("!!!Critical error: attempted to type cast invalid types");
- }
- if (castType.isCompatible(types_1.Types.INTEGER)) {
- return new store_value_1.StoreValue(types_1.Types.INTEGER, stoObj.get().trunc());
- }
- else {
- return new store_value_1.StoreValue(types_1.Types.REAL, stoObj.get());
- }
- }
- extendStore(nextStore) {
- this.nextStore = nextStore;
- }
- applyStore(id) {
- if (!this.store.has(id)) {
- if (this.nextStore != null) {
- return this.nextStore.applyStore(id);
- }
- else {
- throw new Error(`Variable ${id} not found.`);
- }
- }
- const val = this.store.get(id);
- let result = null;
- if (val.type instanceof array_type_1.ArrayType) {
- const array = val;
- const array_type = array.type;
- let l = 0, c = 0;
- const values = array.value.map(v => {
- if (array.isVector) {
- return new store_value_address_1.StoreValueAddress(array_type.innerType, v, l++, undefined, array.id, array.readOnly);
- }
- else {
- if (c >= array.columns) {
- c = 0;
- l += 1;
- }
- return new store_value_address_1.StoreValueAddress(array_type.innerType, v, l, c++, array.id, array.readOnly);
- }
- });
- result = new array_store_value_1.ArrayStoreValue(array_type, values, array.lines, array.columns, val.id, val.readOnly);
- }
- else {
- result = new store_value_1.StoreValue(val.type, val.value, val.id, val.readOnly);
- }
- return result;
- }
- updateStore(id, stoValue) {
- if (!this.store.has(id)) {
- if (this.nextStore != null) {
- this.nextStore.updateStore(id, stoValue);
- return this;
- }
- else {
- // TODO: better error message
- throw new Error(`Variable ${id} not found.`);
- }
- }
- else {
- const oldObj = this.store.get(id);
- if (oldObj.readOnly) {
- // TODO: better error message
- throw new Error("Cannot change value of a read only variable: " + id);
- }
- if (oldObj instanceof storeObjectArray_1.StoreObjectArray) {
- const array_value = stoValue;
- if (oldObj.isCompatible(array_value)) {
- if (oldObj.isVector) {
- array_value.get().forEach((val, index) => {
- oldObj.setAt(val, index, undefined);
- });
- }
- else {
- let line = 0;
- let column = 0;
- array_value.get().forEach((val) => {
- oldObj.setAt(val, line, column);
- column += 1;
- if (column >= oldObj.columns) {
- line += 1;
- column = 0;
- }
- });
- }
- return this;
- }
- }
- else if (oldObj.isCompatible(stoValue)) {
- const loc_address = oldObj.locAddress;
- location_1.Location.updateAddress(loc_address, stoValue.get());
- return this;
- }
- const oldType = oldObj.type;
- const stoType = stoValue.type;
- // TODO: better error message
- throw new Error(`${oldType.value} is not compatible with type ${stoType.value} given`);
- }
- }
- /**
- * Method used to update regions of an array (vector or matrix). The should only be used when update an specific
- * possition since it will only update the required addresses.
- * @param {string} id the variable id to be updated
- * @param {IStoreValue} sto_value the value to be used in the update process
- * @param {number} line the line address of the vector/matrix
- * @param {number} column the matrix column, which can be undefined
- */
- updateStoreArray(id, sto_value, line, column) {
- if (!this.store.has(id)) {
- if (this.nextStore != null) {
- this.nextStore.updateStoreArray(id, sto_value, line, column);
- return this;
- }
- else {
- // TODO: better error message
- throw new Error(`Variable ${id} not found.`);
- }
- }
- else {
- const oldObj = this.store.get(id);
- if (oldObj.readOnly) {
- // TODO: better error message
- throw new Error("Cannot change value of a read only variable: " + id);
- }
- if (oldObj instanceof storeObjectArray_1.StoreObjectArray) {
- if (sto_value instanceof array_store_value_1.ArrayStoreValue) {
- // this must be a vector or matrix line update
- const actual_values = sto_value.get();
- if (oldObj.isVector && sto_value.isVector()) {
- for (let i = 0; i < sto_value.lines; i += 1) {
- const val = actual_values[i];
- oldObj.setAt(val, i, undefined);
- }
- }
- else if (!oldObj.isVector && column == null && sto_value.isVector()) {
- for (let i = 0; i < oldObj.columns; i += 1) {
- const val = actual_values[i];
- oldObj.setAt(val, line, i);
- }
- }
- else {
- // TODO: better error message
- throw new Error(`Attempting to assign an invalid value to array ${id}`);
- }
- }
- else {
- if (!oldObj.isVector && column == null) {
- // TODO: better error message
- throw new Error(`Attempting to assign an invalid value to array ${id}`);
- }
- oldObj.setAt(sto_value, line, column);
- }
- }
- else {
- throw new Error("Cannot update a non-array variable using updateStoreArray");
- }
- // const oldType = oldObj.type;
- // const stoType = sto_value.type;
- // // TODO: better error message
- // throw new Error(`${oldType.value} is not compatible with type ${stoType.value} given`);
- return this;
- }
- }
- /**
- * Inserts a new variable into the Store. This method should be used when declaring a new variable,
- * including the special return variable $.
- * @param id variable id
- * @param stoValue the value to be used as the initial value of id
- */
- insertStore(id, stoValue) {
- if (this.store.has(id)) {
- // TODO: better error message
- throw new Error(`${id} is already defined`);
- }
- // TODO check for array....
- let newObj;
- if (stoValue instanceof store_value_ref_1.StoreValueRef) {
- newObj = new storeObjectRef_1.StoreObjectRef(stoValue);
- }
- else if (stoValue instanceof array_store_value_ref_1.ArrayStoreValueRef) {
- newObj = new store_object_array_ref_1.StoreObjectArrayRef(stoValue, stoValue.lines, stoValue.columns);
- }
- else if (stoValue instanceof array_store_value_1.ArrayStoreValue) {
- const columns = stoValue.isVector() ? 0 : stoValue.columns;
- const addresses = [];
- const all_values = stoValue.get();
- if (all_values.length > 0) {
- for (let i = 0; i < stoValue.get().length; i += 1) {
- const val = all_values[i].get();
- addresses.push(location_1.Location.allocate(val));
- }
- }
- else {
- let total = stoValue.lines;
- total = stoValue.isVector() ? total : total * columns;
- for (let i = 0; i < total; i += 1) {
- addresses.push(location_1.Location.allocate(null));
- }
- }
- newObj = new storeObjectArray_1.StoreObjectArray(stoValue.type, stoValue.lines, columns, addresses, stoValue.isConst);
- }
- else {
- const loc_address = location_1.Location.allocate(stoValue.get());
- newObj = new storeObject_1.StoreObject(stoValue.type, loc_address, stoValue.isConst);
- }
- newObj.setID(id);
- this.store.set(id, newObj);
- return this;
- }
- /**
- * Helper function similar to applyStore. But it returns the actual object in the store be it ref or not
- * applyStore will return the refferenced object if the object in the store is a ref
- */
- getStoreObject(id) {
- if (!this.store.has(id)) {
- if (this.nextStore != null) {
- return this.nextStore.getStoreObject(id);
- }
- else {
- throw new Error(`Variable ${id} not found.`);
- }
- }
- return this.store.get(id);
- }
- destroy() {
- this.store.forEach(sto => sto.destroy(), this);
- }
- isDefined(id) {
- if (!this.store.has(id)) {
- if (this.nextStore != null) {
- return this.nextStore.isDefined(id);
- }
- else {
- return false;
- }
- }
- return true;
- }
- }
- exports.Store = Store;
- /***/ }),
- /***/ "./js/processor/store/storeObject.ts":
- /*!*******************************************!*\
- !*** ./js/processor/store/storeObject.ts ***!
- \*******************************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- "use strict";
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.StoreObject = void 0;
- const location_1 = __webpack_require__(/*! ../../memory/location */ "./js/memory/location.ts");
- class StoreObject {
- /**
- *
- * @param {Type} type
- * @param {Number} loc_address
- * @param {Boolean} readOnly
- */
- constructor(type, loc_address, readOnly = false) {
- this._loc_address = loc_address;
- this._type = type;
- this._readOnly = readOnly;
- this._id = undefined;
- }
- setID(id) {
- this._id = id;
- }
- get id() {
- return this._id;
- }
- get inStore() {
- return this.id !== null;
- }
- get type() {
- return this._type;
- }
- /**
- * Returns the actual value stored at the loccation address present in this object.
- * The returned value is compatible with @prop{StoreObject.type}
- */
- get value() {
- const address = location_1.Location.find(this._loc_address);
- if (address != null) {
- return address.value;
- }
- else {
- throw new Error("!!!Critical Error: variable " + this.id + " does not have a valid address. Loc-Address " + this.locAddress);
- }
- }
- get number() {
- throw new Error("DOT NOT USE THIS PROPERTY!");
- }
- get readOnly() {
- return this._readOnly;
- }
- set readOnly(value) {
- this._readOnly = value;
- }
- isCompatible(another) {
- return this.type.isCompatible(another.type);
- }
- destroy() {
- return location_1.Location.deallocate(this._loc_address);
- }
- get locAddress() {
- return this._loc_address;
- }
- }
- exports.StoreObject = StoreObject;
- /***/ }),
- /***/ "./js/processor/store/storeObjectArray.ts":
- /*!************************************************!*\
- !*** ./js/processor/store/storeObjectArray.ts ***!
- \************************************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- "use strict";
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.StoreObjectArray = void 0;
- const storeObject_1 = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.ts");
- const array_store_value_1 = __webpack_require__(/*! ./value/array_store_value */ "./js/processor/store/value/array_store_value.ts");
- const location_1 = __webpack_require__(/*! ../../memory/location */ "./js/memory/location.ts");
- class StoreObjectArray extends storeObject_1.StoreObject {
- constructor(type, _lines, _columns, loc_addresses, readOnly = false) {
- super(type, -1, readOnly);
- this._lines = _lines;
- this._columns = _columns;
- this.loc_addresses = loc_addresses;
- }
- get lines() {
- return this._lines;
- }
- get columns() {
- return this._columns;
- }
- isCompatible(another) {
- if (another instanceof array_store_value_1.ArrayStoreValue) {
- const cols = another.columns == null ? 0 : another.columns;
- if (this.lines === another.lines && this.columns === cols) {
- return super.isCompatible(another);
- }
- }
- return false;
- }
- get isVector() {
- return this.type.dimensions === 1;
- }
- /**@override
- * Returns the list of values stored by this array.
- * All returned values are compatible with @prop{StoreObject.type}
- */
- get value() {
- const values = [];
- for (let i = 0; i < this.addresses.length; i += 1) {
- const address = location_1.Location.find(this.addresses[i]);
- if (address != null) {
- values.push(address.value);
- }
- else {
- throw new Error("!!!Critical Error: variable " + this.id + " does not have a valid address. Loc-Address " + this.locAddress);
- }
- }
- return values;
- }
- destroy() {
- let bool = true;
- for (let i = 0; i < this.addresses.length; i += 1) {
- bool = bool && location_1.Location.deallocate(this.addresses[i]);
- }
- return bool;
- }
- /**
- * @override
- *
- * Returns the address that contains a list of all addresses of the values present in the array
- */
- get locAddress() {
- throw new Error("!!!Internal Error: Cannot invoke locAddress on StoreObjectArray");
- }
- get addresses() {
- return this.loc_addresses;
- }
- getAt(line, column) {
- if (this.isVector) {
- if (column != null) {
- throw new Error(this.id + " is not a matrix!");
- }
- column = line;
- line = 0;
- }
- else if (column == null) {
- // this is a whole line...
- const values = [];
- for (let col = 0; col < this.columns; col += 1) {
- const index = this.getIndexOf(line, col);
- const address = location_1.Location.find(this.addresses[index]);
- values.push(address.value);
- }
- return values;
- }
- const index = this.getIndexOf(line, column);
- const address = location_1.Location.find(this.addresses[index]);
- return address.value;
- }
- setAt(value, line, column) {
- let used_dims = 1;
- if (column != null) {
- used_dims += 1;
- }
- if (!this.type.canAccept(value.type, used_dims)) {
- throw new Error("!!!Internal Error: Attempting to insert an invalid value inside array " + this.id);
- }
- if (this.isVector) {
- if (column != null) {
- throw new Error(this.id + " is not a matrix!");
- }
- column = line;
- line = 0;
- }
- else if (column == null) {
- throw new Error("!!!Internal Error: Attempting to insert a line into matrix " + this.id);
- }
- const pos = this.getIndexOf(line, column);
- location_1.Location.updateAddress(this.addresses[pos], value.get());
- }
- getIndexOf(line, column) {
- return line * this.columns + column;
- }
- getLocAddressOf(line, column) {
- if (this.isVector) {
- if (column != null) {
- throw new Error(this.id + " is not a matrix!");
- }
- column = line;
- line = 0;
- }
- else if (column == null) {
- // this is a whole line...
- const values = [];
- for (let col = 0; col < this.columns; col += 1) {
- const index = this.getIndexOf(line, col);
- values.push(this.addresses[index]);
- }
- return values;
- }
- const index = this.getIndexOf(line, column);
- return this.addresses[index];
- }
- }
- exports.StoreObjectArray = StoreObjectArray;
- /***/ }),
- /***/ "./js/processor/store/storeObjectRef.ts":
- /*!**********************************************!*\
- !*** ./js/processor/store/storeObjectRef.ts ***!
- \**********************************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- "use strict";
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.StoreObjectRef = void 0;
- const storeObject_1 = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.ts");
- class StoreObjectRef extends storeObject_1.StoreObject {
- /**
- *
- * @param {StoreObject} stoValue
- */
- constructor(stoValue) {
- super(stoValue.type, stoValue.getRefAddress(), false);
- this.refObj = stoValue.id;
- this.reference_dimension = stoValue.getReferenceDimension();
- }
- get isRef() {
- return true;
- }
- getRefObj() {
- return this.refObj;
- }
- getReferenceDimension() {
- return this.reference_dimension;
- }
- destroy() {
- return false;
- }
- }
- exports.StoreObjectRef = StoreObjectRef;
- /***/ }),
- /***/ "./js/processor/store/store_object_array_ref.ts":
- /*!******************************************************!*\
- !*** ./js/processor/store/store_object_array_ref.ts ***!
- \******************************************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- "use strict";
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.StoreObjectArrayRef = void 0;
- const storeObjectArray_1 = __webpack_require__(/*! ./storeObjectArray */ "./js/processor/store/storeObjectArray.ts");
- class StoreObjectArrayRef extends storeObjectArray_1.StoreObjectArray {
- constructor(stoValue, lines, columns) {
- super(stoValue.type, lines, columns, stoValue.getAddresses(), false);
- this.refObj = stoValue.id;
- }
- get isRef() {
- return true;
- }
- getRefObj() {
- return this.refObj;
- }
- destroy() {
- return false;
- }
- }
- exports.StoreObjectArrayRef = StoreObjectArrayRef;
- /***/ }),
- /***/ "./js/processor/store/value/array_store_value.ts":
- /*!*******************************************************!*\
- !*** ./js/processor/store/value/array_store_value.ts ***!
- \*******************************************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- "use strict";
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.ArrayStoreValue = void 0;
- const array_type_1 = __webpack_require__(/*! ../../../typeSystem/array_type */ "./js/typeSystem/array_type.ts");
- const store_value_address_1 = __webpack_require__(/*! ./store_value_address */ "./js/processor/store/value/store_value_address.ts");
- class ArrayStoreValue {
- constructor(type, values, lines, columns, id, isConst = false) {
- this.type = type;
- this.id = id;
- this.isConst = isConst;
- this.values = values;
- this.lines = lines;
- this.columns = columns;
- }
- get() {
- return this.values;
- }
- /**
- * @deprecated
- * Potential not necessary since array access is occuring directly in the StoreObject
- * @param line
- * @param column
- */
- getAt(line, column) {
- console.log("Column ", column);
- if (this.isVector()) {
- if (column != null) {
- throw new Error(this.id + " is not a matrix!");
- }
- column = line;
- line = 0;
- }
- else if (column == null) {
- const values = [];
- for (let col = 0; col < this.columns; col += 1) {
- const index = line * this.lines + col;
- values.push(this.values[index]);
- }
- const array_type = this.type;
- const vector_type = new array_type_1.ArrayType(array_type.innerType, array_type.dimensions - 1);
- return new ArrayStoreValue(vector_type, values, this.columns, 0, this.id, this.isConst);
- }
- const index = line * this.lines + column;
- console.log("Get at: ", index);
- return this.values[index];
- }
- setAt(value, line, column) {
- let used_dims = 1;
- if (column != null) {
- used_dims += 1;
- }
- let actual_line = line;
- let actual_column = column;
- if (!this.type.canAccept(value.type, used_dims)) {
- throw new Error("!!!Internal Error: Attempting to insert an invalid value inside array " + this.id);
- }
- if (this.isVector()) {
- if (column != null) {
- throw new Error(this.id + " is not a matrix!");
- }
- actual_column = actual_line;
- actual_line = 0;
- }
- else if (column == null) {
- if (!(value instanceof ArrayStoreValue)) {
- throw new Error("Attempting to insert a single value as a line of matrix " + this.id);
- }
- const actual_values = value.get();
- for (let i = 0; i < this.columns; i += 1) {
- const pos = actual_line * this.columns + i;
- const val = actual_values[i];
- this.values[pos] = new store_value_address_1.StoreValueAddress(value.type, val.get(), actual_line, i, this.id, this.isConst);
- }
- }
- const columns = this.columns == null ? 0 : this.columns;
- const pos = actual_line * columns + actual_column;
- this.values[pos] = new store_value_address_1.StoreValueAddress(value.type, value.get(), line, column, this.id, this.isConst);
- }
- inStore() {
- return this.id != null;
- }
- isVector() {
- return this.type.dimensions == 1;
- }
- }
- exports.ArrayStoreValue = ArrayStoreValue;
- /***/ }),
- /***/ "./js/processor/store/value/array_store_value_ref.ts":
- /*!***********************************************************!*\
- !*** ./js/processor/store/value/array_store_value_ref.ts ***!
- \***********************************************************/
- /***/ ((__unused_webpack_module, exports) => {
- "use strict";
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.ArrayStoreValueRef = void 0;
- class ArrayStoreValueRef {
- constructor(type, values, addresses, lines, columns, id) {
- this.type = type;
- this.values = values;
- this.addresses = addresses;
- this.lines = lines;
- this.columns = columns;
- this.id = id;
- this.isConst = false;
- }
- get() {
- return this.values;
- }
- getAddresses() {
- return this.addresses;
- }
- inStore() {
- return this.id != null;
- }
- }
- exports.ArrayStoreValueRef = ArrayStoreValueRef;
- /***/ }),
- /***/ "./js/processor/store/value/store_value.ts":
- /*!*************************************************!*\
- !*** ./js/processor/store/value/store_value.ts ***!
- \*************************************************/
- /***/ ((__unused_webpack_module, exports) => {
- "use strict";
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.StoreValue = void 0;
- class StoreValue {
- constructor(type, value, id, isConst = false) {
- this.type = type;
- this.id = id;
- this.isConst = isConst;
- this.value = value;
- }
- get() {
- return this.value;
- }
- inStore() {
- return this.id != null;
- }
- }
- exports.StoreValue = StoreValue;
- /***/ }),
- /***/ "./js/processor/store/value/store_value_address.ts":
- /*!*********************************************************!*\
- !*** ./js/processor/store/value/store_value_address.ts ***!
- \*********************************************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- "use strict";
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.StoreValueAddress = void 0;
- const store_value_1 = __webpack_require__(/*! ./store_value */ "./js/processor/store/value/store_value.ts");
- class StoreValueAddress extends store_value_1.StoreValue {
- constructor(type, value, line, column, id, isConst = false) {
- super(type, value, id, isConst);
- this.line = line;
- this.column = column;
- }
- }
- exports.StoreValueAddress = StoreValueAddress;
- /***/ }),
- /***/ "./js/processor/store/value/store_value_ref.ts":
- /*!*****************************************************!*\
- !*** ./js/processor/store/value/store_value_ref.ts ***!
- \*****************************************************/
- /***/ ((__unused_webpack_module, exports) => {
- "use strict";
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.StoreValueRef = void 0;
- class StoreValueRef {
- constructor(type, value, loc_address, id) {
- this.type = type;
- this.value = value;
- this.loc_address = loc_address;
- this.id = id;
- this.isConst = false;
- this.reference_dimesion = 0;
- }
- get() {
- return this.value;
- }
- getRefAddress() {
- return this.loc_address;
- }
- inStore() {
- return this.id != null;
- }
- getReferenceDimension() {
- return this.reference_dimesion;
- }
- setReferenceDimension(dimension) {
- this.reference_dimesion = dimension;
- }
- }
- exports.StoreValueRef = StoreValueRef;
- /***/ }),
- /***/ "./js/services/languageService.ts":
- /*!****************************************!*\
- !*** ./js/services/languageService.ts ***!
- \****************************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- "use strict";
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.LanguageService = void 0;
- const grammar_1 = __webpack_require__(/*! ./../../grammar/ */ "./grammar/index.ts");
- const line_i18n_1 = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
- const config_1 = __webpack_require__(/*! ./../util/config */ "./js/util/config.ts");
- class LanguageServiceExtended extends line_i18n_1.default.LanguageServiceNoLS {
- constructor() {
- super(typeof iLMparameters === "undefined"
- ? config_1.Config.default_lang
- : iLMparameters.lang);
- }
- getDefaultLang() {
- return "en";
- }
- getCurrentLexer() {
- const langLexer = grammar_1.default[this.getLang()];
- if (langLexer === null || langLexer === undefined) {
- return grammar_1.default[this.getDefaultLang()];
- }
- else {
- return langLexer;
- }
- }
- getCurrentLangFuncs() {
- const langInfo = grammar_1.default[this.getLang()];
- if (langInfo === null || langInfo === undefined) {
- return grammar_1.default[this.getDefaultLang()].getLangFuncs();
- }
- else {
- return langInfo.getLangFuncs();
- }
- }
- getCurrentLangLibs() {
- const langInfo = grammar_1.default[this.getLang()];
- if (langInfo === null || langInfo === undefined) {
- return grammar_1.default[this.getDefaultLang()].getLangLibs();
- }
- return langInfo.getLangLibs();
- }
- }
- exports.LanguageService = new LanguageServiceExtended();
- /***/ }),
- /***/ "./js/typeSystem/array_type.ts":
- /*!*************************************!*\
- !*** ./js/typeSystem/array_type.ts ***!
- \*************************************/
- /***/ ((__unused_webpack_module, exports) => {
- "use strict";
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.ArrayType = void 0;
- class ArrayType {
- constructor(type, dimensions) {
- this.dimensions = dimensions;
- this.innerType = type;
- }
- get isVector() {
- return this.dimensions == 1;
- }
- isCompatible(another) {
- if (another instanceof ArrayType) {
- if (this.dimensions !== another.dimensions) {
- return false;
- }
- return this.innerType.isCompatible(another.innerType);
- }
- return false;
- }
- stringInfo() {
- const list = this.innerType.stringInfo();
- list.forEach(v => {
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- const tmp = v;
- tmp.dim = this.dimensions;
- });
- return list;
- }
- get value() {
- return undefined;
- }
- get ord() {
- return undefined;
- }
- canAccept(another, used_dims) {
- const free_dims = this.dimensions - used_dims;
- if (another instanceof ArrayType) {
- return free_dims == another.dimensions && this.innerType.isCompatible(another.innerType);
- }
- else {
- return free_dims == 0 && this.innerType.isCompatible(another);
- }
- }
- }
- exports.ArrayType = ArrayType;
- /***/ }),
- /***/ "./js/typeSystem/multiType.ts":
- /*!************************************!*\
- !*** ./js/typeSystem/multiType.ts ***!
- \************************************/
- /***/ ((__unused_webpack_module, exports) => {
- "use strict";
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.MultiType = void 0;
- class MultiType {
- constructor(types) {
- this.types = types;
- }
- get value() {
- return undefined;
- }
- get ord() {
- return undefined;
- }
- stringInfo() {
- let list = [];
- for (let i = 0; i < this.types.length; i++) {
- const t = this.types[i];
- list = list.concat(t.stringInfo());
- }
- return list;
- }
- isCompatible(another) {
- for (let i = 0; i < this.types.length; i++) {
- const t = this.types[i];
- if (another.isCompatible(t)) {
- return true;
- }
- }
- return false;
- }
- }
- exports.MultiType = MultiType;
- /***/ }),
- /***/ "./js/typeSystem/type.ts":
- /*!*******************************!*\
- !*** ./js/typeSystem/type.ts ***!
- \*******************************/
- /***/ ((__unused_webpack_module, exports) => {
- "use strict";
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.Type = void 0;
- class Type {
- constructor(value, ord) {
- this.value = value;
- this.ord = ord;
- }
- stringInfo() {
- return [{ type: this.value, dim: 0 }];
- }
- isCompatible(another) {
- return this.value === another.value && this.ord === another.ord;
- }
- }
- exports.Type = Type;
- /***/ }),
- /***/ "./js/typeSystem/types.ts":
- /*!********************************!*\
- !*** ./js/typeSystem/types.ts ***!
- \********************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- "use strict";
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.fromOrdToType = exports.Types = void 0;
- const type_1 = __webpack_require__(/*! ./type */ "./js/typeSystem/type.ts");
- const multiType_1 = __webpack_require__(/*! ./multiType */ "./js/typeSystem/multiType.ts");
- const maybe_1 = __webpack_require__(/*! ../util/maybe */ "./js/util/maybe.ts");
- const INTEGER = new type_1.Type("integer", 0);
- const REAL = new type_1.Type("real", 1);
- const STRING = new type_1.Type("text", 2);
- const BOOLEAN = new type_1.Type("boolean", 3);
- const CHAR = new type_1.Type("char", 4);
- const VOID = new type_1.Type("void", 5);
- const UNDEFINED = new type_1.Type("undefined", 6);
- const ALL = new multiType_1.MultiType([INTEGER, REAL, STRING, CHAR, BOOLEAN]);
- exports.Types = Object.freeze({
- INTEGER: INTEGER,
- REAL: REAL,
- STRING: STRING,
- CHAR: CHAR,
- BOOLEAN: BOOLEAN,
- VOID: VOID,
- UNDEFINED: UNDEFINED,
- ALL: ALL
- });
- function fromOrdToType(ord) {
- const typeMap = exports.Types;
- for (const t in typeMap) {
- if (typeMap[t].ord && typeMap[t].ord === ord) {
- return maybe_1.Maybe.some(typeMap[t]);
- }
- }
- return maybe_1.Maybe.none();
- }
- exports.fromOrdToType = fromOrdToType;
- /***/ }),
- /***/ "./js/util/config.ts":
- /*!***************************!*\
- !*** ./js/util/config.ts ***!
- \***************************/
- /***/ ((__unused_webpack_module, exports) => {
- "use strict";
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.Config = void 0;
- class ConfigObject {
- constructor() {
- this.decimalPlaces = 8;
- this.intConvertRoundMode = 2;
- this.default_lang = "pt";
- this.enable_type_casting = true;
- this.idle_input_interval = 5000;
- this.suspend_threshold = 1000;
- // this.max_instruction_count = 350250; - automated evaluation limit
- this.max_instruction_count = Number.MAX_SAFE_INTEGER;
- this.activity_programming_type = new Map();
- this.activity_functions = new Map();
- this.activity_datatypes = new Map();
- this.activity_commands = new Map();
- this.activity_filter = new Map();
- }
- setConfig(opts) {
- const otherConfig = opts;
- for (const key in otherConfig) {
- if (Object.prototype.hasOwnProperty.call(this, key)) {
- this[key] = otherConfig[key];
- }
- }
- }
- }
- const config = new ConfigObject();
- exports.Config = config;
- /***/ }),
- /***/ "./js/util/maybe.ts":
- /*!**************************!*\
- !*** ./js/util/maybe.ts ***!
- \**************************/
- /***/ ((__unused_webpack_module, exports) => {
- "use strict";
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.Maybe = void 0;
- /**
- *
- * Maybe Monad
- * @Source: https://codewithstyle.info/advanced-functional-programming-in-typescript-maybe-monad/
- * @Modified by: @lucascalion - 28/08/2019
- *
- **/
- class Maybe {
- constructor(value) {
- this.value = value;
- }
- static some(value) {
- if (!value) {
- throw Error("Provided value must not be empty");
- }
- return new Maybe(value);
- }
- static none() {
- return new Maybe(null);
- }
- static fromValue(value) {
- return value ? Maybe.some(value) : Maybe.none();
- }
- getOrElse(defaultValue) {
- return this.value === null ? defaultValue : this.value;
- }
- map(f) {
- if (this.value === null) {
- return Maybe.none();
- }
- else {
- return Maybe.fromValue(f(this.value));
- }
- }
- }
- exports.Maybe = Maybe;
- /***/ }),
- /***/ "./.ima_version.json":
- /*!***************************!*\
- !*** ./.ima_version.json ***!
- \***************************/
- /***/ ((module) => {
- "use strict";
- module.exports = JSON.parse('{"version":"2022_01_07 17_52"}');
- /***/ })
- /******/ });
- /************************************************************************/
- /******/ // The module cache
- /******/ var __webpack_module_cache__ = {};
- /******/
- /******/ // The require function
- /******/ function __webpack_require__(moduleId) {
- /******/ // Check if module is in cache
- /******/ var cachedModule = __webpack_module_cache__[moduleId];
- /******/ if (cachedModule !== undefined) {
- /******/ return cachedModule.exports;
- /******/ }
- /******/ // Create a new module (and put it into the cache)
- /******/ var module = __webpack_module_cache__[moduleId] = {
- /******/ // no module.id needed
- /******/ // no module.loaded needed
- /******/ exports: {}
- /******/ };
- /******/
- /******/ // Execute the module function
- /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
- /******/
- /******/ // Return the exports of the module
- /******/ return module.exports;
- /******/ }
- /******/
- /******/ // expose the modules object (__webpack_modules__)
- /******/ __webpack_require__.m = __webpack_modules__;
- /******/
- /************************************************************************/
- /******/ /* webpack/runtime/chunk loaded */
- /******/ (() => {
- /******/ var deferred = [];
- /******/ __webpack_require__.O = (result, chunkIds, fn, priority) => {
- /******/ if(chunkIds) {
- /******/ priority = priority || 0;
- /******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];
- /******/ deferred[i] = [chunkIds, fn, priority];
- /******/ return;
- /******/ }
- /******/ var notFulfilled = Infinity;
- /******/ for (var i = 0; i < deferred.length; i++) {
- /******/ var [chunkIds, fn, priority] = deferred[i];
- /******/ var fulfilled = true;
- /******/ for (var j = 0; j < chunkIds.length; j++) {
- /******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {
- /******/ chunkIds.splice(j--, 1);
- /******/ } else {
- /******/ fulfilled = false;
- /******/ if(priority < notFulfilled) notFulfilled = priority;
- /******/ }
- /******/ }
- /******/ if(fulfilled) {
- /******/ deferred.splice(i--, 1)
- /******/ var r = fn();
- /******/ if (r !== undefined) result = r;
- /******/ }
- /******/ }
- /******/ return result;
- /******/ };
- /******/ })();
- /******/
- /******/ /* webpack/runtime/compat get default export */
- /******/ (() => {
- /******/ // getDefaultExport function for compatibility with non-harmony modules
- /******/ __webpack_require__.n = (module) => {
- /******/ var getter = module && module.__esModule ?
- /******/ () => (module['default']) :
- /******/ () => (module);
- /******/ __webpack_require__.d(getter, { a: getter });
- /******/ return getter;
- /******/ };
- /******/ })();
- /******/
- /******/ /* webpack/runtime/define property getters */
- /******/ (() => {
- /******/ // define getter functions for harmony exports
- /******/ __webpack_require__.d = (exports, definition) => {
- /******/ for(var key in definition) {
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
- /******/ }
- /******/ }
- /******/ };
- /******/ })();
- /******/
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
- /******/ (() => {
- /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
- /******/ })();
- /******/
- /******/ /* webpack/runtime/make namespace object */
- /******/ (() => {
- /******/ // define __esModule on exports
- /******/ __webpack_require__.r = (exports) => {
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
- /******/ }
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
- /******/ };
- /******/ })();
- /******/
- /******/ /* webpack/runtime/jsonp chunk loading */
- /******/ (() => {
- /******/ // no baseURI
- /******/
- /******/ // object to store loaded and loading chunks
- /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
- /******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
- /******/ var installedChunks = {
- /******/ "main": 0
- /******/ };
- /******/
- /******/ // no chunk on demand loading
- /******/
- /******/ // no prefetching
- /******/
- /******/ // no preloaded
- /******/
- /******/ // no HMR
- /******/
- /******/ // no HMR manifest
- /******/
- /******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);
- /******/
- /******/ // install a JSONP callback for chunk loading
- /******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
- /******/ var [chunkIds, moreModules, runtime] = data;
- /******/ // add "moreModules" to the modules object,
- /******/ // then flag all "chunkIds" as loaded and fire callback
- /******/ var moduleId, chunkId, i = 0;
- /******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
- /******/ for(moduleId in moreModules) {
- /******/ if(__webpack_require__.o(moreModules, moduleId)) {
- /******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
- /******/ }
- /******/ }
- /******/ if(runtime) var result = runtime(__webpack_require__);
- /******/ }
- /******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
- /******/ for(;i < chunkIds.length; i++) {
- /******/ chunkId = chunkIds[i];
- /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
- /******/ installedChunks[chunkId][0]();
- /******/ }
- /******/ installedChunks[chunkIds[i]] = 0;
- /******/ }
- /******/ return __webpack_require__.O(result);
- /******/ }
- /******/
- /******/ var chunkLoadingGlobal = self["webpackChunkivprogCore"] = self["webpackChunkivprogCore"] || [];
- /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
- /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
- /******/ })();
- /******/
- /************************************************************************/
- /******/
- /******/ // startup
- /******/ // Load entry module and return exports
- /******/ // This entry module depends on other loaded chunks and execution need to be delayed
- /******/ 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")))
- /******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
- /******/
- /******/ return __webpack_exports__;
- /******/ })()
- ;
- });
- //# sourceMappingURL=main.351fa5be475052d189cc.js.map
|