ANTLR Parser SyntaxtreeGenerator erweitern.

This commit is contained in:
JanUlrich 2017-02-03 15:20:26 +01:00
parent bee92ef11d
commit 39747f4138
23 changed files with 246 additions and 115 deletions

View File

@ -0,0 +1,14 @@
package de.dhbwstuttgart.core;
import de.dhbwstuttgart.parser.JavaTXParser;
import java.io.File;
import java.io.IOException;
public class JavaTXCompiler {
public void parse(File sourceFile) throws IOException {
new JavaTXParser().parse(sourceFile);
}
}

View File

@ -0,0 +1,24 @@
package de.dhbwstuttgart.parser;
import de.dhbwstuttgart.parser.antlr.Java8Lexer;
import de.dhbwstuttgart.parser.antlr.Java8Parser;
import de.dhbwstuttgart.syntaxtree.ClassOrInterface;
import de.dhbwstuttgart.syntaxtree.SourceFile;
import de.dhbwstuttgart.syntaxtree.modifier.Modifier;
import org.antlr.v4.runtime.ANTLRInputStream;
import org.antlr.v4.runtime.CommonTokenStream;
import java.io.*;
public class JavaTXParser {
public SourceFile parse(File sourceFile) throws IOException {
InputStream stream = new FileInputStream(sourceFile);
ANTLRInputStream input = new ANTLRInputStream(stream);
Java8Lexer lexer = new Java8Lexer(input);
CommonTokenStream tokens = new CommonTokenStream(lexer);
Java8Parser parser = new Java8Parser(tokens);
Java8Parser.CompilationUnitContext tree = parser.compilationUnit();
SyntaxTreeGenerator generator = new SyntaxTreeGenerator();
return generator.convert(tree);
}
}

View File

@ -1,7 +0,0 @@
package de.dhbwstuttgart.parser;
/**
* Created by janulrich on 26.01.17.
*/
public class JavaXParser {
}

View File

@ -3,20 +3,25 @@ package de.dhbwstuttgart.parser;
import de.dhbwstuttgart.parser.antlr.Java8Parser;
import de.dhbwstuttgart.syntaxtree.*;
import de.dhbwstuttgart.syntaxtree.modifier.*;
import de.dhbwstuttgart.syntaxtree.modifier.fieldModifier.FieldModifier;
import de.dhbwstuttgart.syntaxtree.modifier.methodModifier.MethodModifier;
import de.dhbwstuttgart.syntaxtree.statement.Block;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
import de.dhbwstuttgart.typecheck.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.antlr.v4.runtime.Token;
import org.antlr.v4.runtime.tree.TerminalNode;
public class SyntaxTreeGenerator{
JavaClassRegistry reg = new JavaClassRegistry();
String pkgName = null;
String pkgName = "";
List<JavaClassName> imports = null;
public void getNames(Java8Parser.CompilationUnitContext ctx){
if(ctx.packageDeclaration() != null){
this.pkgName = "";
for(TerminalNode t : ctx.packageDeclaration().Identifier()){
this.pkgName = this.pkgName + "." + t.toString();
}
@ -32,7 +37,7 @@ public class SyntaxTreeGenerator{
else{
nameString = typeDecl.interfaceDeclaration().normalInterfaceDeclaration().Identifier().toString();
}
this.reg.existingClasses.add(new JavaClassName(nameString));
this.reg.add(nameString);
}
}
else{
@ -43,7 +48,7 @@ public class SyntaxTreeGenerator{
else{
nameString = typeDecl.classDeclaration().normalClassDeclaration().Identifier().toString();
}
this.reg.existingClasses.add(new JavaClassName(nameString));
this.reg.add(nameString);
}
}
}
@ -53,7 +58,7 @@ public class SyntaxTreeGenerator{
List<ClassOrInterface> classes = new ArrayList<>();
this.getNames(ctx);
for(Java8Parser.TypeDeclarationContext typeDecl : ctx.typeDeclaration()){
ClassOrInterface newClass = null;
ClassOrInterface newClass;
if(typeDecl.classDeclaration() != null){
newClass = convertClass(typeDecl.classDeclaration());
}
@ -88,15 +93,105 @@ public class SyntaxTreeGenerator{
}
JavaClassName name = convert(ctx.Identifier());
Block class_block = null;
List<Field> fielddecl = null;
List<Field> fielddecl = convertFields(ctx.classBody());
GenericDeclarationList genericClassParameters = null;
int offset = 0;
Token offset = ctx.getStart();
RefType superClass = null;
Boolean isInterface = false;
List<RefType> implementedInterfaces = null;
return new ClassOrInterface(modifiers, name, class_block, fielddecl, genericClassParameters, offset, superClass, isInterface, implementedInterfaces);
return new ClassOrInterface(modifiers, name, fielddecl, genericClassParameters, superClass, isInterface, implementedInterfaces, offset);
}
private List<Field> convertFields(Java8Parser.ClassBodyContext classBodyContext) {
List<Field> ret = new ArrayList<>();
for(Java8Parser.ClassBodyDeclarationContext classMember : classBodyContext.classBodyDeclaration()){
if(classMember.classMemberDeclaration()!= null){
Java8Parser.ClassMemberDeclarationContext classMemberDeclarationContext = classMember.classMemberDeclaration();
if(classMemberDeclarationContext.fieldDeclaration()!=null){
ret.addAll(convert(classMember.classMemberDeclaration().fieldDeclaration()));
}else if(classMemberDeclarationContext.methodDeclaration()!= null){
ret.add(convert(classMemberDeclarationContext.methodDeclaration()));
}
}
}
return ret;
}
private Method convert(Java8Parser.MethodDeclarationContext methodDeclarationContext) {
Java8Parser.MethodHeaderContext header = methodDeclarationContext.methodHeader();
String name = header.methodDeclarator().Identifier().getText();
RefType retType;
if(header.result() != null){
if(header.result().unannType() != null)
retType = convert(header.result().unannType());
else retType = new de.dhbwstuttgart.syntaxtree.type.Void(header.result().getStart());
}else{
retType = TypePlaceholder.fresh(header.getStart());
}
List<MethodModifier> modifiers = convert(methodDeclarationContext.methodModifier());
ParameterList parameterList = convert(header.methodDeclarator().formalParameterList());
Block block = null;
if(methodDeclarationContext.methodBody().block() == null){
if(! modifiers.contains(new Abstract())){
//TODO: Error! Abstrakte Methode ohne abstrakt Keyword
}
}else{
block = convert(methodDeclarationContext.methodBody().block());
}
GenericDeclarationList gtvDeclarations = new GenericDeclarationList(new ArrayList<>(), methodDeclarationContext.methodHeader().getStart());
if(methodDeclarationContext.methodHeader().typeParameters() != null){
gtvDeclarations = convert(methodDeclarationContext.methodHeader().typeParameters());
}
return new Method(name, retType, modifiers, parameterList,block, gtvDeclarations, methodDeclarationContext.getStart());
}
private GenericDeclarationList convert(Java8Parser.TypeParametersContext typeParametersContext) {
return null;
}
private Block convert(Java8Parser.BlockContext block) {
return null;
}
private ParameterList convert(Java8Parser.FormalParameterListContext formalParameterListContext) {
List<FormalParameter> ret = new ArrayList<>();
if(formalParameterListContext != null){
}
return new ParameterList(ret);
}
private List<MethodModifier> convert(List<Java8Parser.MethodModifierContext> methodModifierContexts) {
//TODO
return new ArrayList<>();
}
private List<? extends Field> convert(Java8Parser.FieldDeclarationContext fieldDeclarationContext) {
List<Field> ret = new ArrayList<>();
List<FieldModifier> modifiers = new ArrayList<>();
for(Java8Parser.FieldModifierContext fieldModifierContext : fieldDeclarationContext.fieldModifier()){
//TODO
}
RefType fieldType = convert(fieldDeclarationContext.unannType());
for(Java8Parser.VariableDeclaratorContext varCtx : fieldDeclarationContext.variableDeclaratorList().variableDeclarator()){
String fieldName = varCtx.variableDeclaratorId().getText();
if(varCtx.variableInitializer() != null){
//Feld mit Initialwert
//TODO
}else{
//Feld ohne Initialwert
ret.add(new Field(fieldName,fieldType,modifiers,varCtx.getStart()));
}
}
return ret;
}
private RefType convert(Java8Parser.UnannTypeContext unannTypeContext) {
//TODO
return null;
}
private Modifier convert(Java8Parser.ClassModifierContext ctx){
Modifier newModifier = null;
if(ctx.annotation() == null){
@ -137,7 +232,7 @@ public class SyntaxTreeGenerator{
else{
name = t.toString();
}
return new JavaClassName(name);
return this.reg.getName(name);
}
private ClassOrInterface convertEnum(Java8Parser.EnumDeclarationContext ctx){

View File

@ -321,7 +321,7 @@ classBodyDeclaration
: classMemberDeclaration
| instanceInitializer
| staticInitializer
| constructorDeclaration
// | constructorDeclaration
;
classMemberDeclaration
@ -443,7 +443,7 @@ methodModifier
methodHeader
: result? methodDeclarator throws_?
| typeParameters annotation* result methodDeclarator throws_?
| typeParameters annotation* result? methodDeclarator throws_?
;
result

View File

@ -6,6 +6,7 @@ import de.dhbwstuttgart.syntaxtree.modifier.Modifiers;
import de.dhbwstuttgart.syntaxtree.statement.Block;
import de.dhbwstuttgart.syntaxtree.statement.Expr;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import org.antlr.v4.runtime.Token;
import java.util.ArrayList;
import java.util.List;
@ -16,24 +17,21 @@ import java.util.List;
public class ClassOrInterface extends GTVDeclarationContext implements IItemWithOffset, Generic{
protected Modifiers modifiers;
protected JavaClassName name;
private Block class_block;
private List<Field> fielddecl = new ArrayList<>();
private GenericDeclarationList genericClassParameters;
private int offset;
private Token offset;
private RefType superClass;
protected boolean isInterface;
private List<RefType> implementedInterfaces;
public ClassOrInterface(Modifiers modifiers, JavaClassName name, Block class_block, List<Field> fielddecl, GenericDeclarationList genericClassParameters, int offset, RefType superClass, Boolean isInterface, List<RefType> implementedInterfaces){
public ClassOrInterface(Modifiers modifiers, JavaClassName name, List<Field> fielddecl, GenericDeclarationList genericClassParameters,
RefType superClass, Boolean isInterface, List<RefType> implementedInterfaces, Token offset){
if(modifiers != null){
this.modifiers = modifiers;
}
if(name != null){
this.name = name;
}
if(class_block != null){
this.class_block = class_block;
}
if(fielddecl != null){
this.fielddecl = fielddecl;
}

View File

@ -1,16 +1,20 @@
package de.dhbwstuttgart.syntaxtree;
import de.dhbwstuttgart.syntaxtree.modifier.methodModifier.MethodModifier;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import org.antlr.v4.runtime.Token;
import org.apache.bcel.Constants;
import org.apache.bcel.generic.InstructionList;
import de.dhbwstuttgart.typecheck.JavaClassName;
import de.dhbwstuttgart.syntaxtree.statement.Block;
import java.util.List;
public class Constructor extends Method {
public Constructor(String name, RefType returnType, ParameterList parameterList, Block block, GenericDeclarationList gtvDeclarations, int offset) {
super(name, returnType, parameterList, block, gtvDeclarations, offset);
public Constructor(String name, RefType returnType, List<MethodModifier> modifiers, ParameterList parameterList, Block block, GenericDeclarationList gtvDeclarations, Token offset) {
super(name, returnType, modifiers, parameterList, block, gtvDeclarations, offset);
}
}

View File

@ -1,15 +1,19 @@
package de.dhbwstuttgart.syntaxtree;
import de.dhbwstuttgart.syntaxtree.modifier.fieldModifier.FieldModifier;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import org.antlr.v4.runtime.Token;
public abstract class Field extends GTVDeclarationContext implements Generic {
import java.util.List;
public class Field extends GTVDeclarationContext implements Generic {
private String name;
private GenericDeclarationList genericParameters;
public Field(String name, RefType type, int offset){
public Field(String name, RefType type, List<? extends FieldModifier> modifier, Token offset){
this.name = name;
}

View File

@ -1,5 +1,8 @@
package de.dhbwstuttgart.syntaxtree;
import com.sun.org.apache.xpath.internal.operations.Mod;
import de.dhbwstuttgart.syntaxtree.modifier.fieldModifier.FieldModifier;
import org.antlr.v4.runtime.Token;
import org.apache.bcel.generic.FieldGen;
import org.apache.bcel.generic.FieldInstruction;
import org.apache.bcel.generic.InstructionList;
@ -9,6 +12,9 @@ import org.apache.bcel.generic.ClassGen;
import de.dhbwstuttgart.syntaxtree.statement.Expr;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import java.util.List;
/**
* Eine Feldinitialisation steht ¼r eine Felddeklaration mit gleichzeitiger Wertzuweisung
* Beispiel: 'public Feld FeldVar = FeldWert;'
@ -23,8 +29,8 @@ public class FieldDeclaration extends Field{
* Dieser Konstruktor der FieldDeclaration erstellt den Syntaxknoten vollständig.
* Kein nachträgliches hinzfügen von Informationen oder aufrufen von parserPostProcessing ist notwendig.
*/
public FieldDeclaration(String name, RefType typ, Expr value){
super(name, typ, 0);//Dieser Deklarator wird nicht vom Parser aufgerufen. Dadurch gibt es auch keinen Offset
public FieldDeclaration(String name, RefType typ, List<FieldModifier> modifier, Expr value, Token offset){
super(name, typ, modifier, offset);//Dieser Deklarator wird nicht vom Parser aufgerufen. Dadurch gibt es auch keinen Offset
this.wert = value;
}

View File

@ -1,5 +1,7 @@
package de.dhbwstuttgart.syntaxtree;
import org.antlr.v4.runtime.Token;
import java.util.*;
@ -11,17 +13,13 @@ import java.util.*;
*/
public class GenericDeclarationList extends SyntaxTreeNode implements Iterable<GenericTypeVar>{
private int offsetOfLastElement;
private Token offsetOfLastElement;
private List<GenericTypeVar> gtvs = new ArrayList<>();
public GenericDeclarationList(List<GenericTypeVar> values, int endOffset) {
public GenericDeclarationList(List<GenericTypeVar> values, Token endOffset) {
gtvs = values;
this.offsetOfLastElement = endOffset;
}
public int getEndOffset(){
return offsetOfLastElement;
}
@Override
public Iterator<GenericTypeVar> iterator() {

View File

@ -3,7 +3,10 @@ package de.dhbwstuttgart.syntaxtree;
import java.util.ArrayList;
import java.util.List;
import de.dhbwstuttgart.syntaxtree.modifier.fieldModifier.FieldModifier;
import de.dhbwstuttgart.syntaxtree.modifier.methodModifier.MethodModifier;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import org.antlr.v4.runtime.Token;
import org.apache.bcel.Constants;
import org.apache.bcel.generic.InstructionList;
@ -31,9 +34,9 @@ public class Method extends Field implements IItemWithOffset
private List<String> types_in_parameterlist = new ArrayList<>();
private Modifiers modifiers;
public Method(String name, RefType returnType, ParameterList parameterList, Block block,
GenericDeclarationList gtvDeclarations, int offset) {
super(name, returnType, offset);
public Method(String name, RefType returnType, List<MethodModifier> modifiers, ParameterList parameterList, Block block,
GenericDeclarationList gtvDeclarations, Token offset) {
super(name, returnType, modifiers, offset);
this.name = name;
this.parameterlist = parameterList;
this.block = block;

View File

@ -0,0 +1,4 @@
package de.dhbwstuttgart.syntaxtree.modifier.fieldModifier;
public interface FieldModifier {
}

View File

@ -0,0 +1,6 @@
package de.dhbwstuttgart.syntaxtree.modifier.methodModifier;
import de.dhbwstuttgart.syntaxtree.modifier.fieldModifier.FieldModifier;
public interface MethodModifier extends FieldModifier {
}

View File

@ -1,6 +1,7 @@
package de.dhbwstuttgart.syntaxtree.type;
import org.antlr.v4.runtime.Token;
/**
* Stellt eine Wildcard mit oberer Grenze dar.
@ -16,7 +17,7 @@ public class ExtendsWildcardType extends WildcardType{
* Author: Arne ¼dtke<br/>
* Standard Konstruktor ¼r eine ExtendsWildcard
*/
public ExtendsWildcardType (int offset, RefType extendsType)
public ExtendsWildcardType ( RefType extendsType,Token offset)
{
super(extendsType, offset);
}

View File

@ -29,7 +29,7 @@ public class FunN extends RefType {
* @return
*/
public FunN(RefType R, List<? extends RefType> T) {
super(null,0);
super(null,null);
}
/**

View File

@ -4,6 +4,7 @@ import java.util.List;
import de.dhbwstuttgart.typecheck.JavaClassName;
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
import org.antlr.v4.runtime.Token;
public class RefType extends SyntaxTreeNode
@ -25,7 +26,7 @@ public class RefType extends SyntaxTreeNode
*/
private boolean primitiveFlag=false;
public RefType(JavaClassName fullyQualifiedName, int offset)
public RefType(JavaClassName fullyQualifiedName, Token offset)
{
this.name = (fullyQualifiedName);
}
@ -38,7 +39,7 @@ public class RefType extends SyntaxTreeNode
return hash;
}
public RefType(JavaClassName fullyQualifiedName, List<RefType> parameter, int offset)
public RefType(JavaClassName fullyQualifiedName, List<RefType> parameter, Token offset)
{
this(fullyQualifiedName, offset);
if(parameter != null && parameter.size()>0)this.parameter = parameter;

View File

@ -1,6 +1,8 @@
package de.dhbwstuttgart.syntaxtree.type;
import org.antlr.v4.runtime.Token;
/**
* Stellt eine Wildcard mit unterer Grenze dar.
* z.B. void test(? super Integer var){..}
@ -11,16 +13,11 @@ package de.dhbwstuttgart.syntaxtree.type;
public class SuperWildcardType extends WildcardType{
public SuperWildcardType(RefType innerType){
super(null, 0);
}
/**
* Author: Arne ¼dtke<br/>
* Standard Konstruktor ¼r eine SuperWildcard
*/
public SuperWildcardType(int offset, RefType innerType)
public SuperWildcardType(Token offset, RefType innerType)
{
super(innerType, offset);
}

View File

@ -2,6 +2,7 @@ package de.dhbwstuttgart.syntaxtree.type;
import java.util.Hashtable;
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
import org.antlr.v4.runtime.Token;
/**
* Repr�sentiert einen Typparameter ¯Â¿Â½r einen vom Programmierer nicht angegeben
@ -15,7 +16,8 @@ public class TypePlaceholder extends RefType
{
private static Hashtable<String, TypePlaceholder> m_TypePlaceholdersRegistry = new Hashtable<String, TypePlaceholder>();
private SyntaxTreeNode parent;
private final String name;
@ -25,9 +27,10 @@ public class TypePlaceholder extends RefType
* <br>Author: ¯Â¿Â½rg ¯Â¿Â½uerle
* @param typeName Der Name der TypePlaceholder-Variablen
*/
private TypePlaceholder(String typeName, SyntaxTreeNode parent)
private TypePlaceholder(String name)
{
super(null, -1);
super(null,null);
this.name = name;
}
/**
@ -61,8 +64,7 @@ public class TypePlaceholder extends RefType
* @param listener
* @return
*/
public static TypePlaceholder fresh(SyntaxTreeNode parent){
public static TypePlaceholder fresh(Token position){
return null;
}
@ -82,62 +84,10 @@ public class TypePlaceholder extends RefType
return false;
}
}
/**
* ¯Â¿Â½scht die komplette Registry von TypePlaceholders. Sollte nur und
* ausschlie�lich von <code>MyCompiler.init()</code> aufgerufen werden!!!
* <br/>Author: ¯Â¿Â½rg ¯Â¿Â½uerle
*/
public static void deleteRegistry()
{
m_TypePlaceholdersRegistry.clear();
m_TypePlaceholdersRegistry = new Hashtable<String, TypePlaceholder>();
}
/**
* Diese Methode sollte nur sehr sparsam und mit Vorsicht verwendet werden, da die
* Registrierung neuer Listener �ber die zentrale Instanz in der Registry laufen
* muss.<br/>
* Diese Methode erzeugt eine Kopie dieser zentralen Instanz. Listener, die sich
* �ber diese Kopie registrieren, werden sp�ter nicht �ber Status�nderungen
* benachrichtigt, d.h. ihre TypePlaceholders werden nicht substituiert.
* <br/>Author: ¯Â¿Â½rg ¯Â¿Â½uerle
* @return
*/
public TypePlaceholder clone()
{
TypePlaceholder dolly = new TypePlaceholder(name.toString(), this.parent);
return dolly;
}
public String toString()
{
return "TPH " + this.getName();
}
///////////////////////////////////////////////////////////////////
// Spezialfunktionen, ¯Â¿Â½r makeFC() und unify()
// Sollten sonst nicht aufgerufen werden...
///////////////////////////////////////////////////////////////////
/**
* Backdoor-Hilfsfunktion, die ¯Â¿Â½r <code>makeFC()</code> und <code>unify()</code>
* ben�tigt wird, um neue TypePlaceholders zu erzeugen. Die erzeugten Variablen
* werden nicht registriert und sind ¯Â¿Â½llig losgel�st vom abstrakten Syntaxbaum.
* <br>Author: ¯Â¿Â½rg ¯Â¿Â½uerle
* @return Eine neue <code>TypePlaceholder</code>
*/
public static TypePlaceholder backdoorFresh()
{
//PL 05-08-22 SEHR GEFAEHRLICH
//backdoorvars werden registiert, weil am Ende beim execute
//auf den CSubstitution nicht registrierte Variablen zu
//Exceptions fuehrt
TypePlaceholder typeVar = new TypePlaceholder(null, null);
m_TypePlaceholdersRegistry.put(typeVar.getName().toString(), typeVar);
return typeVar;
//return new TypePlaceholder(makeNewName());
return "TPH " + this.name;
}
}

View File

@ -0,0 +1,17 @@
package de.dhbwstuttgart.syntaxtree.type;
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
import de.dhbwstuttgart.typecheck.JavaClassName;
import org.antlr.v4.runtime.Token;
import java.util.ArrayList;
import java.util.List;
public class Void extends RefType
{
public Void(Token offset) {
super(JavaClassName.Void, offset);
}
}

View File

@ -1,5 +1,7 @@
package de.dhbwstuttgart.syntaxtree.type;
import org.antlr.v4.runtime.Token;
/**
* Stellt eine Wildcard in Java dar.
* z.B. void Test(? var){..}
@ -15,7 +17,7 @@ public abstract class WildcardType extends RefType{
* Author: Arne ¼dtke<br/>
* Standard Konstruktor ¼r eine Wildcard
*/
public WildcardType(RefType innerType, int offset)
public WildcardType(RefType innerType, Token offset)
{
super(innerType.getName(), offset);
this.innerType = innerType;

View File

@ -11,10 +11,11 @@ import java.util.List;
*/
public class JavaClassName {
public static final JavaClassName Void = new JavaClassName("void");
private String name;
private PackageName packageName;
public JavaClassName(String name){
JavaClassName(String name){
if(name == null)throw new NullPointerException();
String[] names = name.split("[.]");

View File

@ -9,10 +9,19 @@ import java.util.List;
public class JavaClassRegistry {
public List<JavaClassName> existingClasses = new ArrayList<>();
public void add(String className){
existingClasses.add(new JavaClassName(className));
}
public JavaClassName getName(String className) {
for(JavaClassName name : existingClasses){
if(name.toString().equals(className))return name;
if(name.equals(new JavaClassName(className)))return name;
}
throw new TypeNotPresentException(className, new Throwable());
}
@Override
public String toString(){
return existingClasses.toString();
}
}

View File

@ -11,6 +11,8 @@ import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import de.dhbwstuttgart.core.JavaTXCompiler;
import de.dhbwstuttgart.parser.JavaTXParser;
import junit.framework.TestCase;
import org.junit.Test;
@ -34,13 +36,15 @@ public class GeneralParserTest{
List<String> filenames = new ArrayList<String>();
filenames.add("FieldInitializationTest.jav");
filenames.add("ImportTest.jav");
filenames.add("BoundedParameter.jav");
filenames.add("GenericFieldVarTest.jav");
//filenames.add("BoundedParameter.jav");
//filenames.add("GenericFieldVarTest.jav");
filenames.add("FieldVarTest.jav");
//MyCompilerAPI compiler = MyCompiler.getAPI(config);
filenames.add("StructuralTypes.jav");
JavaTXParser parser = new JavaTXParser();
try{
for(String filename : filenames) {
//compiler.parse(new File(rootDirectory + filename));
System.out.println("Teste: "+filename);
parser.parse(new File(rootDirectory + filename));
//TODO: Test ANTLR Parser
}
}catch(Exception exc){