Commit 28742f3a authored by Anders Nilsson's avatar Anders Nilsson
Browse files

Having problems with top-level classes no longer explicitly declaring themselves on top level

parent cd5ee26b
...@@ -10,7 +10,7 @@ import AST.Start; ...@@ -10,7 +10,7 @@ import AST.Start;
public class DumpClasses extends Parser { public class DumpClasses extends Parser {
public static void main(String args[]) { public static void main(String args[]) {
Start ast = parse(args); Start ast = parse(args[0]);
// Dump the AST // Dump the AST
// ast.dumpTree(" ", System.out); // ast.dumpTree(" ", System.out);
......
...@@ -14,10 +14,14 @@ public class GenCompiler extends Parser { ...@@ -14,10 +14,14 @@ public class GenCompiler extends Parser {
public static void main(String args[]) { public static void main(String args[]) {
String name = "default"; String name = "default";
String dirName = "default";
String owlFile = ""; String owlFile = "";
int i = 0; int i = 0;
while (i<args.length) { while (i<args.length) {
if (args[i].equals("-d")) { if (args[i].equals("-d")) {
dirName = args[++i];
i++;
} else if (args[i].equals("-n")) {
name = args[++i]; name = args[++i];
i++; i++;
} else { } else {
...@@ -27,7 +31,7 @@ public class GenCompiler extends Parser { ...@@ -27,7 +31,7 @@ public class GenCompiler extends Parser {
Start ast = parse(owlFile); Start ast = parse(owlFile);
File siarasDir = new File(name); File siarasDir = new File(dirName);
if (!siarasDir.isDirectory()) { if (!siarasDir.isDirectory()) {
siarasDir.mkdir(); siarasDir.mkdir();
} }
...@@ -35,17 +39,17 @@ public class GenCompiler extends Parser { ...@@ -35,17 +39,17 @@ public class GenCompiler extends Parser {
String fileName = null; String fileName = null;
try { try {
// Generate JastAdd abstract grammar // Generate JastAdd abstract grammar
fileName = name+"/"+name+".ast"; fileName = dirName+"/"+name+".ast";
PrintStream pStream = new PrintStream(new File(fileName)); PrintStream pStream = new PrintStream(new File(fileName));
ast.genAbsGrammar(pStream); ast.genAbsGrammar(pStream);
// Generate Parser.java // Generate Parser.java
fileName = name+"/Parser.java"; fileName = dirName+"/Parser.java";
pStream = new PrintStream(new File(fileName)); pStream = new PrintStream(new File(fileName));
ast.genParser(pStream); ast.genParser(pStream);
// Generate aspects // Generate aspects
fileName = name+"/GeneratedAspects.jrag"; fileName = dirName+"/GeneratedAspects.jrag";
pStream = new PrintStream(new File(fileName)); pStream = new PrintStream(new File(fileName));
ast.genAspects(pStream); ast.genAspects(pStream);
......
...@@ -31,6 +31,7 @@ aspect Types { ...@@ -31,6 +31,7 @@ aspect Types {
eq OwlClassUse.decl() { eq OwlClassUse.decl() {
ComplexElement top = getTopElement(); ComplexElement top = getTopElement();
for (int i=0; i<top.getNumElement(); i++) { for (int i=0; i<top.getNumElement(); i++) {
// System.out.println(getId()+" == "+((ComplexElement) top.getElement(i)).getId());
if ((top.getElement(i) instanceof ComplexElement) && if ((top.getElement(i) instanceof ComplexElement) &&
getId().equals(((ComplexElement) top.getElement(i)).getId())) { getId().equals(((ComplexElement) top.getElement(i)).getId())) {
return (OwlClassDecl) top.getElement(i); return (OwlClassDecl) top.getElement(i);
......
Markdown is supported
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