forked from JavaTX/JavaCompilerCore
SyntaxTreeNode.getDescription() angefügt
This commit is contained in:
parent
b29fa03782
commit
5d57179364
@ -828,8 +828,10 @@ public class MyCompiler implements MyCompilerAPI
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void parse(String sourceCode) {
|
public SourceFile parse(String sourceCode) {
|
||||||
this.m_AbstractSyntaxTree.add(this.parse2SyntaxTree(new StringReader(sourceCode)));
|
SourceFile ret = this.parse2SyntaxTree(new StringReader(sourceCode));
|
||||||
|
this.m_AbstractSyntaxTree.add(ret);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
@ -127,8 +127,9 @@ public interface MyCompilerAPI
|
|||||||
/**
|
/**
|
||||||
* Parst den SourceCode einer Datei.
|
* Parst den SourceCode einer Datei.
|
||||||
* @param sourceCode - SourceCode einer Java-Quellcodedatei
|
* @param sourceCode - SourceCode einer Java-Quellcodedatei
|
||||||
|
* @return den aus dem sourceCode generierten Syntaxbaum
|
||||||
*/
|
*/
|
||||||
public void parse(String sourceCode);
|
public SourceFile parse(String sourceCode);
|
||||||
|
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
@ -33,4 +33,12 @@ public abstract class SyntaxTreeNode {
|
|||||||
if(parent == null)throw new TypinferenzException("Das Wurzelelement eines Syntaxbaumes muss Class sein");
|
if(parent == null)throw new TypinferenzException("Das Wurzelelement eines Syntaxbaumes muss Class sein");
|
||||||
return parent.getParentClass();
|
return parent.getParentClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Eine Beschreibung/Name des SyntaxTree-Nodes
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getDescription(){
|
||||||
|
return this.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1314,5 +1314,10 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription(){
|
||||||
|
return "class "+this.getName();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
@ -90,4 +90,9 @@ public abstract class Field extends SyntaxTreeNode implements TypeInsertable, Ty
|
|||||||
public String getIdentifier() {
|
public String getIdentifier() {
|
||||||
return this.get_Name().firstElement().get_Name();
|
return this.get_Name().firstElement().get_Name();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription(){
|
||||||
|
return this.getIdentifier();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -699,7 +699,5 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
7
test/plugindevelopment/SyntaxTreeTests.java
Normal file
7
test/plugindevelopment/SyntaxTreeTests.java
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
package plugindevelopment;
|
||||||
|
|
||||||
|
public class SyntaxTreeTests {
|
||||||
|
|
||||||
|
//TODO: Hier tests für getChildren anfügen.
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user