i want construct subtrees of parsetree, class contains insertchild(index,object) method seems commontree, , cannot pass rulecontext type object, because tries convert tree object, , "java.lang.classcastexception: java8parser$classdeclarationcontext cannot cast org.antlr.runtime.tree.tree" exception.
any ideas? thanks. (edit: added code)
private void getsubtrees(parsetree tree){ commontree commontree = new commontree(); setrecursivedescendants(commontree, tree); } private commontree setrecursivedescendants(commontree commontree,parsetree parsetree){ int n = parsetree.getchildcount(); (int = 0; < n; i++) { commontree.insertchild(i, parsetree.getchild(i); setrecursivedescendants(commontree, parsetree.getchild(i)); } return commontree; }
Comments
Post a Comment