Commit 7fc6b164 authored by baueko's avatar baueko
Browse files

added another missing file, changed encoding

parent 48ea4f8f
......@@ -83,7 +83,7 @@ public abstract class CodeBlock extends AbstractNode {
});
registerPreVisit("Block", (arg0, arg1) -> {
// neues Element hinzufgen und absteigen
// neues Element hinzuf�gen und absteigen
Location l = arg1.get(arg1.size() - 1).right();
JavaDeclarationsTreeElement t = new JavaDeclarationsTreeElement(l, tree);
tree.addChild(t);
......@@ -92,12 +92,12 @@ public abstract class CodeBlock extends AbstractNode {
});
registerPostVisit("Block", (arg0, arg1) -> {
// TODO fix empty trees
// baum zurcksetzen und null-Bume lschen
// baum zurücksetzen und null-Bäume löschen
// wenn selber null und Kinder null/keine Kinder
// aus childrenliste des parents selbst lschen
// aus childrenliste des parents selbst löschen
// wenn Kinder nicht null
// Im Children von Parents eigene Kinder eintragen und umgedreht
// aus Children von Parent lschen
// aus Children von Parent löschen
// (Wenn selber nicht null -> nix tun)
tree = tree.getParent();
......
package de.in.tum.www2.cup.ast;
import java.io.*;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamWriter;
import javax.xml.transform.Source;
......@@ -14,20 +18,19 @@ import mouse.runtime.SourceString;
import java_cup.runtime.SyntaxTreeTransform;
public class JavaCompiler {
private static String[] blacklist = { "VariableDeclaratorId" };
public static XMLElement parseJava(String blob, CodeBlock codeblock) throws Exception {
public static XMLElement parseJava(String blob, CodeBlock codeblock) {
SourceString src = new SourceString(blob);
JavaParser parser = new JavaParser();
boolean ok = false;
switch (codeblock.getBt()) {
case Action: // ?
case Parser:
// TODO change parsing method
ok = parser.parse(src);
ok = parser.parseClassBody(src);
break;
default:// Init, Scan, ActionCodeBlock
// TODO change parsing method
ok = parser.parse(src);
ok = parser.parseMethodBody(src);
break;
}
......@@ -36,7 +39,11 @@ public class JavaCompiler {
System.out.println(" -> Compilation succeeded");
XMLElement elem = (XMLElement) sem.rule.rhs(0).get();
// Remove unwanted unary branch chains from the syntax tree
elem = SyntaxTreeTransform.removeUnaryChains(elem);
List<String> blacklistList = Arrays.asList(blacklist);
// elem = SyntaxTreeTransform.removeUnaryChainsBlacklist(elem,
// blacklistList);
// elem = SyntaxTreeTransform.removeUnaryChains(elem);
System.out.println(elem);
return elem;
}
......
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