Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,5 @@ plugins ...@@ -7,7 +7,5 @@ plugins
testontologies/ontologyV06_Jambalaya.properties testontologies/ontologyV06_Jambalaya.properties
siaras/Parser.java siaras/Parser.java
siaras/Siaras.ast siaras/Siaras.ast
siaras/PrettyPrinter.jrag
siaras/Rewrites.jrag
siaras/log.tmp siaras/log.tmp
*Jambalaya.properties *Jambalaya.properties
...@@ -109,6 +109,16 @@ aspect AbsGrammarGeneration { ...@@ -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 { aspect GenPrettyPrinter {
public void ASTNode.genPrettyPrinter(String ind, PrintStream pStream) { public void ASTNode.genPrettyPrinter(String ind, PrintStream pStream) {
for (int i=0; i<getNumChild(); i++) { for (int i=0; i<getNumChild(); i++) {
...@@ -117,8 +127,6 @@ aspect GenPrettyPrinter { ...@@ -117,8 +127,6 @@ aspect GenPrettyPrinter {
} }
public void Start.genPrettyPrinter(String ind, PrintStream pStream) { public void Start.genPrettyPrinter(String ind, PrintStream pStream) {
pStream.println();
pStream.println("import java.io.PrintStream;");
pStream.println(); pStream.println();
pStream.println("aspect PrettyPrinter {"); pStream.println("aspect PrettyPrinter {");
pStream.println(" public void ASTNode.prettyPrint(String indent, PrintStream pStream) {"); pStream.println(" public void ASTNode.prettyPrint(String indent, PrintStream pStream) {");
...@@ -156,8 +164,6 @@ aspect GenRewrites { ...@@ -156,8 +164,6 @@ aspect GenRewrites {
} }
public void Start.genRewrites(PrintStream pStream) { public void Start.genRewrites(PrintStream pStream) {
pStream.println();
pStream.println("import java.io.PrintStream;");
pStream.println(); pStream.println();
pStream.println("aspect Rewrites {"); pStream.println("aspect Rewrites {");
super.genRewrites(pStream); super.genRewrites(pStream);
......
...@@ -40,15 +40,17 @@ public class GenCompiler extends Parser { ...@@ -40,15 +40,17 @@ public class GenCompiler extends Parser {
pStream = new PrintStream(new File(fileName)); pStream = new PrintStream(new File(fileName));
ast.genParser(pStream); ast.genParser(pStream);
// Generate Rewrites // Generate aspects
fileName = "siaras/Rewrites.jrag"; fileName = "siaras/GeneratedAspects.jrag";
pStream = new PrintStream(new File(fileName)); pStream = new PrintStream(new File(fileName));
ast.genRewrites(pStream); ast.genAspects(pStream);
// ast.genRewrites(pStream);
// ast.genPrettyPrinter("",pStream);
// Generate PrettyPrinter // Generate PrettyPrinter
fileName = "siaras/PrettyPrinter.jrag"; // fileName = "siaras/PrettyPrinter.jrag";
pStream = new PrintStream(new File(fileName)); // pStream = new PrintStream(new File(fileName));
ast.genPrettyPrinter("",pStream); // ast.genPrettyPrinter("",pStream);
} catch (java.io.FileNotFoundException e) { } catch (java.io.FileNotFoundException e) {
System.out.println("Could not create file: "+fileName); System.out.println("Could not create file: "+fileName);
e.printStackTrace(); e.printStackTrace();
......
Source diff could not be displayed: it is too large. Options to address this: view the blob.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment