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 java.util.List;
|
||||||
import org.antlr.v4.runtime.tree.TerminalNode;
|
import org.antlr.v4.runtime.tree.TerminalNode;
|
||||||
public class SyntaxTreeGenerator{
|
public class SyntaxTreeGenerator{
|
||||||
JavaClassRegistry reg = new JavaClassRegistry();
|
private JavaClassRegistry reg;
|
||||||
String pkgName = null;
|
private String pkgName = "";
|
||||||
List<JavaClassName> imports = null;
|
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){
|
if(ctx.packageDeclaration() != null){
|
||||||
this.pkgName = "";
|
|
||||||
for(TerminalNode t : ctx.packageDeclaration().Identifier()){
|
for(TerminalNode t : ctx.packageDeclaration().Identifier()){
|
||||||
this.pkgName = this.pkgName + "." + t.toString();
|
this.pkgName = this.pkgName + "." + t.toString();
|
||||||
}
|
}
|
||||||
this.pkgName = this.pkgName.substring(1);
|
this.pkgName = this.pkgName.substring(1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getNames(Java8Parser.CompilationUnitContext ctx){
|
||||||
String nameString = "";
|
String nameString = "";
|
||||||
for (Java8Parser.TypeDeclarationContext typeDecl : ctx.typeDeclaration()){
|
for (Java8Parser.TypeDeclarationContext typeDecl : ctx.typeDeclaration()){
|
||||||
if(typeDecl.interfaceDeclaration() != null){
|
if(typeDecl.interfaceDeclaration() != null){
|
||||||
@ -49,6 +55,10 @@ public class SyntaxTreeGenerator{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public JavaClassRegistry getReg{
|
||||||
|
return this.reg;
|
||||||
|
}
|
||||||
|
|
||||||
public SourceFile convert(Java8Parser.CompilationUnitContext ctx){
|
public SourceFile convert(Java8Parser.CompilationUnitContext ctx){
|
||||||
List<ClassOrInterface> classes = new ArrayList<>();
|
List<ClassOrInterface> classes = new ArrayList<>();
|
||||||
this.getNames(ctx);
|
this.getNames(ctx);
|
||||||
|
Loading…
Reference in New Issue
Block a user