forked from JavaTX/JavaCompilerCore
* "Normal" class and interface names can now be resolved.
* TODO: line comments
This commit is contained in:
parent
fb10220da9
commit
3c6ffcf4d8
@ -29,6 +29,7 @@ public class RunParser{
|
||||
for(JavaClassName name : generator.reg.existingClasses){
|
||||
System.out.println(name.toString());
|
||||
}
|
||||
System.out.println(generator.reg.existingClasses.size());
|
||||
}
|
||||
catch(Exception e){
|
||||
System.out.println("An exception occured which is unknown and on our TODO list.");
|
||||
|
@ -13,17 +13,33 @@ public class SyntaxTreeGenerator{
|
||||
|
||||
public void getNames(Java8Parser.CompilationUnitContext ctx){
|
||||
String packageDecl = "";
|
||||
List<TerminalNode> decls = ctx.packageDeclaration().Identifier();
|
||||
if(decls != null){
|
||||
for(TerminalNode t : decls){
|
||||
if(ctx.packageDeclaration() != null){
|
||||
for(TerminalNode t : ctx.packageDeclaration().Identifier()){
|
||||
packageDecl = packageDecl + "." + t.toString();
|
||||
}
|
||||
packageDecl = packageDecl.substring(1);
|
||||
}
|
||||
String nameString = "";
|
||||
for (Java8Parser.TypeDeclarationContext typeDecl : ctx.typeDeclaration()){
|
||||
if(typeDecl.interfaceDeclaration() != null){
|
||||
if(typeDecl.interfaceDeclaration().normalInterfaceDeclaration() != null){
|
||||
String nameString = packageDecl + "." + typeDecl.interfaceDeclaration().normalInterfaceDeclaration().Identifier().toString();
|
||||
if(packageDecl != ""){
|
||||
nameString = packageDecl + "." + typeDecl.interfaceDeclaration().normalInterfaceDeclaration().Identifier().toString();
|
||||
}
|
||||
else{
|
||||
nameString = typeDecl.interfaceDeclaration().normalInterfaceDeclaration().Identifier().toString();
|
||||
}
|
||||
this.reg.existingClasses.add(new JavaClassName(nameString));
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(typeDecl.classDeclaration().normalClassDeclaration() != null){
|
||||
if(packageDecl != ""){
|
||||
nameString = packageDecl + "." + typeDecl.classDeclaration().normalClassDeclaration().Identifier().toString();
|
||||
}
|
||||
else{
|
||||
nameString = typeDecl.classDeclaration().normalClassDeclaration().Identifier().toString();
|
||||
}
|
||||
this.reg.existingClasses.add(new JavaClassName(nameString));
|
||||
}
|
||||
}
|
||||
|
@ -2,3 +2,4 @@
|
||||
|
||||
* Core-Problem: Typinferenz vs. Konstruktoren
|
||||
* möglicherweise Problem: falsche Return-Expressions
|
||||
* Problem: Line-Comments werden nicht erkannt bzw. führen dazu dass das gesamte File nicht geparsed wird (Java8.g4).
|
||||
|
Loading…
Reference in New Issue
Block a user