Commit 5c86f48d authored by Anders Nilsson's avatar Anders Nilsson
Browse files

Cleaned up aspect generation so that only one jrag file is automatically generated

parent 6e9a5503
......@@ -7,7 +7,5 @@ plugins
testontologies/ontologyV06_Jambalaya.properties
siaras/Parser.java
siaras/Siaras.ast
siaras/PrettyPrinter.jrag
siaras/Rewrites.jrag
siaras/log.tmp
*Jambalaya.properties
......@@ -109,6 +109,16 @@ aspect AbsGrammarGeneration {
}
aspect GenAspects {
public void Start.genAspects(PrintStream pStream) {
pStream.println();
pStream.println("import java.io.PrintStream;");
pStream.println();
genRewrites(pStream);
genPrettyPrinter(" ",pStream);
}
}
aspect GenPrettyPrinter {
public void ASTNode.genPrettyPrinter(String ind, PrintStream pStream) {
for (int i=0; i<getNumChild(); i++) {
......@@ -117,8 +127,6 @@ aspect GenPrettyPrinter {
}
public void Start.genPrettyPrinter(String ind, PrintStream pStream) {
pStream.println();
pStream.println("import java.io.PrintStream;");
pStream.println();
pStream.println("aspect PrettyPrinter {");
pStream.println(" public void ASTNode.prettyPrint(String indent, PrintStream pStream) {");
......@@ -156,8 +164,6 @@ aspect GenRewrites {
}
public void Start.genRewrites(PrintStream pStream) {
pStream.println();
pStream.println("import java.io.PrintStream;");
pStream.println();
pStream.println("aspect Rewrites {");
super.genRewrites(pStream);
......
......@@ -40,15 +40,17 @@ public class GenCompiler extends Parser {
pStream = new PrintStream(new File(fileName));
ast.genParser(pStream);
// Generate Rewrites
fileName = "siaras/Rewrites.jrag";
// Generate aspects
fileName = "siaras/GeneratedAspects.jrag";
pStream = new PrintStream(new File(fileName));
ast.genRewrites(pStream);
ast.genAspects(pStream);
// ast.genRewrites(pStream);
// ast.genPrettyPrinter("",pStream);
// Generate PrettyPrinter
fileName = "siaras/PrettyPrinter.jrag";
pStream = new PrintStream(new File(fileName));
ast.genPrettyPrinter("",pStream);
// fileName = "siaras/PrettyPrinter.jrag";
// pStream = new PrintStream(new File(fileName));
// ast.genPrettyPrinter("",pStream);
} catch (java.io.FileNotFoundException e) {
System.out.println("Could not create file: "+fileName);
e.printStackTrace();
......
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment