Skip to content
Snippets Groups Projects
Commit f9b26267 authored by Johannes Mey's avatar Johannes Mey
Browse files

fix CLI, add option --ast for scope4j

parent dd9b4954
No related branches found
No related tags found
No related merge requests found
......@@ -140,6 +140,9 @@ jastadd {
run {
mainClassName = 'org.extendj.ScopeAnalysis'
if (project.hasProperty("appArgs")) {
args Eval.me(appArgs)
}
}
task preprocess(type: JavaExec) {
......
......@@ -105,6 +105,9 @@ jastadd {
run {
mainClassName = 'org.jmodelica.SimpleMain'
if (project.hasProperty("appArgs")) {
args Eval.me(appArgs)
}
}
task preprocess(type: JavaExec) {
......
......@@ -35,15 +35,16 @@ public class ScopeAnalysis {
boolean debug = arguments.isEmpty() || arguments.remove("--debug");
boolean tree = arguments.remove("--tree");
boolean warnings = arguments.remove("--warnings");
boolean ast = arguments.remove("--ast");
if (arguments.size() > 1) {
System.out.println("usage: ScopeAnalysis [--debug] [--tree] [--warnings] <directory with modelica files>");
System.out.println("usage: ScopeAnalysis [--debug] [--tree] [--warnings] [--ast] <directory with modelica files>");
System.exit(-1);
}
String path = arguments.isEmpty() ? "../testprograms/modelica/simple" : arguments.get(arguments.size() - 1);
String path = arguments.isEmpty() ? "../testprograms/modelica/simple" : arguments.get(0);
if (debug) {
new ScopeAnalysis().analyze(path, tree, warnings);
new ScopeAnalysis().analyze(path, tree, warnings, ast);
} else {
new ScopeAnalysis().analyzeTimed(path);
}
......@@ -97,7 +98,7 @@ public class ScopeAnalysis {
}
public Set<AbstractFinding> analyze(String path, boolean tree, boolean warnings) {
public Set<AbstractFinding> analyze(String path, boolean tree, boolean warnings, boolean ast) {
try {
List<String> files = Files.walk(Paths.get(path))
.filter(Files::isRegularFile)
......@@ -112,8 +113,9 @@ public class ScopeAnalysis {
}
// TODO just temp debug output:
if (ast) {
sourceRoot.printAST();
}
if (warnings) {
// TODO find out if there are compiler warnings in JModelica
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment