Skip to content

Commit

Permalink
added monitor jobStart for programmatic module imports Evaluator::doI…
Browse files Browse the repository at this point in the history
…mport
  • Loading branch information
jurgenvinju committed Jun 17, 2024
1 parent c42d25e commit ca348e7
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 300 deletions.
9 changes: 7 additions & 2 deletions src/org/rascalmpl/interpreter/Evaluator.java
Original file line number Diff line number Diff line change
Expand Up @@ -1166,14 +1166,19 @@ public Result<IValue> eval(IRascalMonitor monitor, Declaration declaration) {
}
}

public void doImport(IRascalMonitor monitor, String string) {
public void doImport(IRascalMonitor monitor, String... string) {
IRascalMonitor old = setMonitor(monitor);
interrupt = false;
try {
monitor.jobStart(LOADING_JOB_CONSTANT, string.length);
ISourceLocation uri = URIUtil.rootLocation("import");
org.rascalmpl.semantics.dynamic.Import.importModule(string, uri, this);
for (String module : string) {
monitor.jobStep(LOADING_JOB_CONSTANT, "Starting on " + module);
org.rascalmpl.semantics.dynamic.Import.importModule(module, uri, this);
}
}
finally {
monitor.jobEnd(LOADING_JOB_CONSTANT, true);
setMonitor(old);
setCurrentAST(null);
}
Expand Down
286 changes: 0 additions & 286 deletions src/org/rascalmpl/interpreter/JavaToRascal.java

This file was deleted.

22 changes: 12 additions & 10 deletions src/org/rascalmpl/parser/ParserGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,18 @@ public ParserGenerator(IRascalMonitor monitor, OutputStream out, List<ClassLoade
this.bridge = new JavaBridge(loaders, factory, config);
this.vf = factory;

evaluator.doImport(monitor, "lang::rascal::grammar::ParserGenerator");
evaluator.doImport(monitor, "lang::rascal::grammar::ConcreteSyntax");
evaluator.doImport(monitor, "lang::rascal::grammar::definition::Modules");
evaluator.doImport(monitor, "lang::rascal::grammar::definition::Priorities");
evaluator.doImport(monitor, "lang::rascal::grammar::definition::Regular");
evaluator.doImport(monitor, "lang::rascal::grammar::definition::Keywords");
evaluator.doImport(monitor, "lang::rascal::grammar::definition::Literals");
evaluator.doImport(monitor, "lang::rascal::grammar::definition::Parameters");
evaluator.doImport(monitor, "lang::rascal::grammar::definition::Symbols");
evaluator.doImport(monitor, "analysis::grammars::Ambiguity");
evaluator.doImport(monitor,
"lang::rascal::grammar::ParserGenerator",
"lang::rascal::grammar::ConcreteSyntax",
"lang::rascal::grammar::definition::Modules",
"lang::rascal::grammar::definition::Priorities",
"lang::rascal::grammar::definition::Regular",
"lang::rascal::grammar::definition::Keywords",
"lang::rascal::grammar::definition::Literals",
"lang::rascal::grammar::definition::Parameters",
"lang::rascal::grammar::definition::Symbols",
"analysis::grammars::Ambiguity"
);
}

public void setGeneratorProfiling(boolean f) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ private void processModules() {
evaluator.jobTodo(jn, 1);

try {
evaluator.doImport(new NullRascalMonitor(), module);
evaluator.doImport(evaluator.getMonitor(), module);
}
catch (Throwable e) {
synchronized(stdout) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public Description getDescription() {
evaluator.jobStep(jobName, "Preparing " + name);

try {
evaluator.doImport(new NullRascalMonitor(), name);
evaluator.doImport(evaluator.getMonitor(), name);
List<AbstractFunction> tests = heap.getModule(name.replaceAll("\\\\","")).getTests();

if (tests.isEmpty()) {
Expand Down

0 comments on commit ca348e7

Please sign in to comment.