use of kalang.compiler.DefaultCompileContext in project kalang by kasonyang.
the class CompilantUnitTest method test.
@Test
public void test() {
KalangSource source = new KalangSource("Test", "class{" + "void main(){" + "}" + "}", "Test.kl");
CompilationUnit cu = new CompilationUnit(source, new DefaultCompileContext());
cu.compile(CompilePhase.PHASE_PARSING);
AstBuilder astBuilder = cu.getAstBuilder();
ParseTreeNavigator treeNav = new ParseTreeNavigator(astBuilder.getParseTree());
ParseTree tree = treeNav.getParseTree(0);
assertNotNull(tree);
ParseTree treeMd = treeNav.getParseTree(2);
ParseTree treeMdEnd = treeNav.getParseTree(7);
// System.out.println(treeMd);
// System.out.println(treeMdEnd);
assertNotNull(treeMd);
assertNotNull(treeMdEnd);
// assertEquals(treeMd, treeMdEnd.getParent().getParent());
// AstNode ast = sp.getAstNode(tree);
// assertNotNull(ast);
// System.out.println("ast:"+ast);
// RuleContext treeOfAst = sp.getParseTree(ast);
// assertNotNull(treeOfAst);
}
Aggregations