Skip to content

Commit

Permalink
gives access to generic dsl properties
Browse files Browse the repository at this point in the history
  • Loading branch information
Manuel Leduc committed Nov 25, 2019
1 parent ffda463 commit ad1eb5b
Showing 1 changed file with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class Dsl {
String sourceFile;
List<String> allSyntaxes = new ArrayList<>();
List<String> allSemantics = new ArrayList<>();
private Properties dslProp;

public Dsl(List<String> syntaxes, List<String> semantics) {
this.allSyntaxes.addAll(syntaxes);
Expand All @@ -40,17 +41,17 @@ public Dsl(String dslFile) throws FileNotFoundException {

public Dsl(InputStream input) {

Properties dslProp = new Properties();
this.dslProp = new Properties();
try {
dslProp.load(input);
getDslProp().load(input);
input.close();
} catch (IOException e) {
// TODO Throw the exception: it cannot be handled here
e.printStackTrace();
}

String allSyntaxes = (String) dslProp.get("syntax");
String allBehaviors = (String) dslProp.get("behavior");
String allSyntaxes = (String) getDslProp().get("syntax");
String allBehaviors = (String) getDslProp().get("behavior");

if(allSyntaxes != null && allBehaviors != null) {
String[] syntaxes = allSyntaxes.split(",");
Expand Down Expand Up @@ -94,4 +95,14 @@ public void save() {
protected List<String> trim(String[] uris) {
return Arrays.asList(uris).stream().map(s->s.trim()).collect(toList());
}

public Properties getDslProp() {
return dslProp;
}

public String getSourceFile() {
return sourceFile;
}


}

0 comments on commit ad1eb5b

Please sign in to comment.