forked from JavaTX/JavaCompilerCore
JavaClassRegistry is now required for constructor.
This commit is contained in:
parent
a4dc47cc4e
commit
d55d6734d9
@ -10,18 +10,24 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.antlr.v4.runtime.tree.TerminalNode;
|
||||
public class SyntaxTreeGenerator{
|
||||
JavaClassRegistry reg = new JavaClassRegistry();
|
||||
String pkgName = null;
|
||||
List<JavaClassName> imports = null;
|
||||
private JavaClassRegistry reg;
|
||||
private String pkgName = "";
|
||||
List<JavaClassName> imports = new ArrayList();
|
||||
|
||||
public void getNames(Java8Parser.CompilationUnitContext ctx){
|
||||
public SyntaxTreeGenerator(JavaClassRegistry reg){
|
||||
this.reg = reg;
|
||||
}
|
||||
|
||||
public void setPackageName(Java8Parser.CompilationUnitContext ctx){
|
||||
if(ctx.packageDeclaration() != null){
|
||||
this.pkgName = "";
|
||||
for(TerminalNode t : ctx.packageDeclaration().Identifier()){
|
||||
this.pkgName = this.pkgName + "." + t.toString();
|
||||
}
|
||||
this.pkgName = this.pkgName.substring(1);
|
||||
}
|
||||
}
|
||||
|
||||
public void getNames(Java8Parser.CompilationUnitContext ctx){
|
||||
String nameString = "";
|
||||
for (Java8Parser.TypeDeclarationContext typeDecl : ctx.typeDeclaration()){
|
||||
if(typeDecl.interfaceDeclaration() != null){
|
||||
@ -48,6 +54,10 @@ public class SyntaxTreeGenerator{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public JavaClassRegistry getReg{
|
||||
return this.reg;
|
||||
}
|
||||
|
||||
public SourceFile convert(Java8Parser.CompilationUnitContext ctx){
|
||||
List<ClassOrInterface> classes = new ArrayList<>();
|
||||
|
Loading…
Reference in New Issue
Block a user