当前位置: 首页>>代码示例>>Java>>正文


Java CommonTreeAdaptor类代码示例

本文整理汇总了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);
            }
        }
    }
 
开发者ID:antlr,项目名称:codebuff,代码行数:40,代码来源:STViz.java

示例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);
            }
        }
    }
 
开发者ID:antlr,项目名称:codebuff,代码行数:38,代码来源:STViz.java

示例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);
			}
		}
	}
 
开发者ID:antlr,项目名称:codebuff,代码行数:40,代码来源:STViz.java

示例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);
}
 
开发者ID:tunnelvisionlabs,项目名称:goworks,代码行数:10,代码来源:CompiledModelParser.java

示例5: JTreeASTModel

import org.antlr.runtime.tree.CommonTreeAdaptor; //导入依赖的package包/类
public JTreeASTModel(Object root) {
    this.adaptor = new CommonTreeAdaptor();
    this.root = root;
}
 
开发者ID:antlr,项目名称:codebuff,代码行数:5,代码来源:JTreeASTModel.java


注:本文中的org.antlr.runtime.tree.CommonTreeAdaptor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。