Skip to content
Snippets Groups Projects
Commit 699b7ef9 authored by Ronny Böttger's avatar Ronny Böttger
Browse files

RoleRag with added EmptyDeclaration

parent 9889a13e
No related branches found
No related tags found
No related merge requests found
Pipeline #11600 failed
......@@ -4,7 +4,7 @@ pluginManagement {
}
}
rootProject.name = 'abstract_type_navigation_generator'
rootProject.name = 'RoleRag'
include 'relast.preprocessor'
aspect AddEmptyDeclaration {
syn GrammarFile GrammarFile.addEmptyDecl() {
Declaration emptyDecl = new EmptyDeclaration();
SingleLineComment slc = new SingleLineComment();
slc.setText("// DO NOT EDIT. Automatically generated using RoleAST.jar");
emptyDecl.addComment(slc);
JastAddList declList = new JastAddList();
declList.add(emptyDecl);
for (Declaration decl : this.getDeclarationList()) {
declList.add(decl);
}
this.setDeclarationList(declList);
//this.addDeclaration(emptyDecl);
return this;
}
}
......@@ -4,11 +4,13 @@ import org.jastadd.option.BooleanOption;
import org.jastadd.option.ValueOption;
import org.jastadd.relast.ast.Document;
import org.jastadd.relast.ast.Program;
import org.jastadd.relast.ast.GrammarFile;
import org.jastadd.relast.compiler.CompilerException;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.nio.file.Path;
import java.nio.file.Paths;
import static org.jastadd.relast.compiler.Mustache.javaMustache;
......@@ -23,7 +25,7 @@ public class Main extends org.jastadd.relast.compiler.RelAstProcessor {
protected BooleanOption optionPrintYaml;
public Main() {
super("Abstract Type Navigation Generator", false);
super("RoleRag", false);
}
public static void main(String[] args) {
......@@ -101,6 +103,14 @@ public class Main extends org.jastadd.relast.compiler.RelAstProcessor {
throw new CompilerException("Unable to expand template", e);
}
for (GrammarFile grammarFile : program.getGrammarFileList()) {
printMessage("Writing output file " + grammarFile.getFileName());
// TODO decide and document what the file name should be, the full path or a simple name?
grammarFile.addEmptyDecl();
writeToFile(outputBasePath.resolve(inputBasePath.relativize(Paths.get(grammarFile.getFileName()))), grammarFile.generateAbstractGrammar());
}
return 0;
}
}
- name: "AddEmptyDeclaration (null)"
out: "out"
args:
- "--inputBaseDir=in"
- "--outputBaseDir=out"
- "--errorHandling=null"
- "Example.relast"
- "EmptyDeclaration.relast"
// DO NOT EDIT. Automatically generated using RoleAST.jar
StateMachine ::= Element*;
abstract Element ::= <Label:String>;
State : Element ::=;
Transition : Element ::=;
rel StateMachine.initial -> State;
rel StateMachine.final* -> State;
rel State.outgoing* <-> Transition.from;
rel State.incoming* <-> Transition.to;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment