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 { ...@@ -140,6 +140,9 @@ jastadd {
run { run {
mainClassName = 'org.extendj.ScopeAnalysis' mainClassName = 'org.extendj.ScopeAnalysis'
if (project.hasProperty("appArgs")) {
args Eval.me(appArgs)
}
} }
task preprocess(type: JavaExec) { task preprocess(type: JavaExec) {
......
...@@ -105,6 +105,9 @@ jastadd { ...@@ -105,6 +105,9 @@ jastadd {
run { run {
mainClassName = 'org.jmodelica.SimpleMain' mainClassName = 'org.jmodelica.SimpleMain'
if (project.hasProperty("appArgs")) {
args Eval.me(appArgs)
}
} }
task preprocess(type: JavaExec) { task preprocess(type: JavaExec) {
......
...@@ -35,15 +35,16 @@ public class ScopeAnalysis { ...@@ -35,15 +35,16 @@ public class ScopeAnalysis {
boolean debug = arguments.isEmpty() || arguments.remove("--debug"); boolean debug = arguments.isEmpty() || arguments.remove("--debug");
boolean tree = arguments.remove("--tree"); boolean tree = arguments.remove("--tree");
boolean warnings = arguments.remove("--warnings"); boolean warnings = arguments.remove("--warnings");
boolean ast = arguments.remove("--ast");
if (arguments.size() > 1) { 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); 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) { if (debug) {
new ScopeAnalysis().analyze(path, tree, warnings); new ScopeAnalysis().analyze(path, tree, warnings, ast);
} else { } else {
new ScopeAnalysis().analyzeTimed(path); new ScopeAnalysis().analyzeTimed(path);
} }
...@@ -97,7 +98,7 @@ public class ScopeAnalysis { ...@@ -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 { try {
List<String> files = Files.walk(Paths.get(path)) List<String> files = Files.walk(Paths.get(path))
.filter(Files::isRegularFile) .filter(Files::isRegularFile)
...@@ -112,8 +113,9 @@ public class ScopeAnalysis { ...@@ -112,8 +113,9 @@ public class ScopeAnalysis {
} }
// TODO just temp debug output: if (ast) {
sourceRoot.printAST(); sourceRoot.printAST();
}
if (warnings) { if (warnings) {
// TODO find out if there are compiler warnings in JModelica // 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