private static void spawnAndRun() { TestUtils.reset("--run--"); slurpModuleCode(); if (spawnFile == null) die("No Thorn file specified."); if (!spawnFile.exists()) die("Thorn file " + spawnFile + " does not exist."); String srcCode = Bard.contentsOf(spawnFile); SiteTh site = new SiteTh("localhost", port); try { Syntax syn = prepare( srcCode, moduleCode); // SealTest.sealize("thorn", srcCode, SyntacticClass.STMT, moduleCode); if (SealTest.thereAreErrors()) { die("\n" + "\nThere were errors!\n " + Bard.sep(Compilation.current.messages, "\n")); } if (!(syn instanceof Spawn)) { die("Currently, the thorn code after -s must be a spawn."); } Spawn spawn = (Spawn) syn; SiteData sd = SiteData.start(site, spawn, Frame.rootFrame()); } catch (FisherException e) { e.printStackTrace(); } }
private static Syntax prepare(String srcCode, String moduleCode) { Syntax res = null; try { res = SealTest.sealize("thorn", srcCode, SyntacticClass.STMT, moduleCode); // checkSealsOnAllIds(res); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (FisherException e) { // TODO Auto-generated catch block e.printStackTrace(); } if (SealTest.thereAreErrors()) { die("\n" + "\nThere were errors!\n " + Bard.sep(Compilation.current.messages, "\n")); } return res; }
private static void evalAndRun() { try { TestUtils.reset("--run--"); slurpModuleCode(); if (evalFile == null) die("No Thorn file specified."); if (!evalFile.exists()) die("Thorn file " + evalFile + " does not exist."); String srcCode = Bard.contentsOf(evalFile); Cmd cmd = (Cmd) SealTest.sealize("thorn", srcCode, SyntacticClass.STMT, moduleCode); if (SealTest.thereAreErrors()) { die("\n" + "\nThere were errors!\n " + Bard.sep(Compilation.current.messages, "\n")); } Thing res = Evaller.fullEval(cmd); if (printResultOfEval) { System.out.println(EvalUtil.toString(res)); } } catch (ParseException e) { e.printStackTrace(); } catch (FisherException e) { e.printStackTrace(); } }