本文整理汇总了Java中org.antlr.runtime.tree.CommonTreeAdaptor类的典型用法代码示例。如果您正苦于以下问题:Java CommonTreeAdaptor类的具体用法?Java CommonTreeAdaptor怎么用?Java CommonTreeAdaptor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CommonTreeAdaptor类属于org.antlr.runtime.tree包,在下文中一共展示了CommonTreeAdaptor类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateCurrentST
import org.antlr.runtime.tree.CommonTreeAdaptor; //导入依赖的package包/类
private void updateCurrentST(STViewFrame m) {
// System.out.println("updateCurrentST(): currentScope.st="+currentScope.st);
// update all views according to currentScope.st
updateStack(currentScope, m); // STACK
updateAttributes(currentScope, m); // ATTRIBUTES
setText(m.bytecode, currentScope.st.impl.disasm()); // BYTECODE DIS.
setText(m.template, currentScope.st.impl.template); // TEMPLATE SRC
JTreeASTModel astModel = new JTreeASTModel(new CommonTreeAdaptor(), currentScope.st.impl.ast);
viewFrame.ast.setModel(astModel);
// highlight output text and, if {...} subtemplate, region in ST src
// get last event for currentScope.st; it's the event that captures ST eval
if ( currentEvent instanceof EvalExprEvent ) {
EvalExprEvent exprEvent = (EvalExprEvent)currentEvent;
highlight(m.output, exprEvent.outputStartChar, exprEvent.outputStopChar);
highlight(m.template, exprEvent.exprStartChar, exprEvent.exprStopChar);
}
else {
EvalTemplateEvent templateEvent;
if ( currentEvent instanceof EvalTemplateEvent ) {
templateEvent = (EvalTemplateEvent)currentEvent;
}
else {
List<InterpEvent> events = currentScope.events;
templateEvent = (EvalTemplateEvent)events.get(events.size()-1);
}
if ( templateEvent!=null ) {
highlight(m.output,
templateEvent.outputStartChar,
templateEvent.outputStopChar);
}
if ( currentScope.st.isAnonSubtemplate() ) {
Interval r = currentScope.st.impl.getTemplateRange();
//System.out.println("currentScope.st src range="+r);
//m.template.moveCaretPosition(r.a);
highlight(m.template, r.a, r.b);
}
}
}
示例2: updateCurrentST
import org.antlr.runtime.tree.CommonTreeAdaptor; //导入依赖的package包/类
private void updateCurrentST(STViewFrame m) {
// System.out.println("updateCurrentST(): currentScope.st="+currentScope.st);
// update all views according to currentScope.st
updateStack(currentScope, m); // STACK
updateAttributes(currentScope, m); // ATTRIBUTES
setText(m.bytecode, currentScope.st.impl.disasm()); // BYTECODE DIS.
setText(m.template, currentScope.st.impl.template); // TEMPLATE SRC
JTreeASTModel astModel = new JTreeASTModel(new CommonTreeAdaptor(), currentScope.st.impl.ast);
viewFrame.ast.setModel(astModel);
// highlight output text and, if {...} subtemplate, region in ST src
// get last event for currentScope.st; it's the event that captures ST eval
if ( currentEvent instanceof EvalExprEvent ) {
EvalExprEvent exprEvent = (EvalExprEvent)currentEvent;
highlight(m.output, exprEvent.outputStartChar, exprEvent.outputStopChar);
highlight(m.template, exprEvent.exprStartChar, exprEvent.exprStopChar);
}
else {
EvalTemplateEvent templateEvent;
if ( currentEvent instanceof EvalTemplateEvent ) {
templateEvent = (EvalTemplateEvent)currentEvent;
}
else {
List<InterpEvent> events = currentScope.events;
templateEvent = (EvalTemplateEvent)events.get(events.size()-1);
}
if ( templateEvent!=null ) {
highlight(m.output, templateEvent.outputStartChar, templateEvent.outputStopChar);
}
if ( currentScope.st.isAnonSubtemplate() ) {
Interval r = currentScope.st.impl.getTemplateRange();
//System.out.println("currentScope.st src range="+r);
//m.template.moveCaretPosition(r.a);
highlight(m.template, r.a, r.b);
}
}
}
示例3: updateCurrentST
import org.antlr.runtime.tree.CommonTreeAdaptor; //导入依赖的package包/类
private void updateCurrentST(STViewFrame m) {
// System.out.println("updateCurrentST(): currentScope.st="+currentScope.st);
// update all views according to currentScope.st
updateStack(currentScope, m); // STACK
updateAttributes(currentScope, m); // ATTRIBUTES
setText(m.bytecode, currentScope.st.impl.disasm()); // BYTECODE DIS.
setText(m.template, currentScope.st.impl.template); // TEMPLATE SRC
JTreeASTModel astModel = new JTreeASTModel(new CommonTreeAdaptor(), currentScope.st.impl.ast);
viewFrame.ast.setModel(astModel);
// highlight output text and, if {...} subtemplate, region in ST src
// get last event for currentScope.st; it's the event that captures ST eval
if (currentEvent instanceof EvalExprEvent) {
EvalExprEvent exprEvent = (EvalExprEvent)currentEvent;
highlight(m.output, exprEvent.outputStartChar, exprEvent.outputStopChar);
highlight(m.template, exprEvent.exprStartChar, exprEvent.exprStopChar);
}
else {
EvalTemplateEvent templateEvent;
if (currentEvent instanceof EvalTemplateEvent) {
templateEvent = (EvalTemplateEvent)currentEvent;
}
else {
List<InterpEvent> events = currentScope.events;
templateEvent = (EvalTemplateEvent)events.get(events.size() - 1);
}
if (templateEvent != null) {
highlight(m.output, templateEvent.outputStartChar, templateEvent.outputStopChar);
}
if ( currentScope.st.isAnonSubtemplate() ) {
Interval r = currentScope.st.impl.getTemplateRange();
//System.out.println("currentScope.st src range="+r);
//m.template.moveCaretPosition(r.a);
highlight(m.template, r.a, r.b);
}
}
}
示例4: buildAstForGroupTemplates
import org.antlr.runtime.tree.CommonTreeAdaptor; //导入依赖的package包/类
private TemplateGroupRuleReturnScope buildAstForGroupTemplates(TemplateGroupWrapper group) {
TreeAdaptor adaptor = new CommonTreeAdaptor();
Object tree = adaptor.nil();
for (CompiledST template : group.getCompiledTemplates()) {
adaptor.addChild(tree, template.ast);
}
return new TemplateGroupRuleReturnScope(group, (CommonTree)tree);
}
示例5: JTreeASTModel
import org.antlr.runtime.tree.CommonTreeAdaptor; //导入依赖的package包/类
public JTreeASTModel(Object root) {
this.adaptor = new CommonTreeAdaptor();
this.root = root;
}