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


Java TreeAdaptor.create方法代码示例

本文整理汇总了Java中org.antlr.runtime.tree.TreeAdaptor.create方法的典型用法代码示例。如果您正苦于以下问题:Java TreeAdaptor.create方法的具体用法?Java TreeAdaptor.create怎么用?Java TreeAdaptor.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.antlr.runtime.tree.TreeAdaptor的用法示例。


在下文中一共展示了TreeAdaptor.create方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addAttribute

import org.antlr.runtime.tree.TreeAdaptor; //导入方法依赖的package包/类
/**
 * Add a new attribute to a parent node.
 * @param adaptor the tree helper
 * @param parent parent node
 * @param tokenType the new node token type
 * @param tokenText the new node name
 * @param value the new node value
 * @return a new node that was just added to parent
 */
private Object addAttribute(
        final TreeAdaptor adaptor,
        final Object parent,
        final int tokenType,
        final String tokenText, final String value) {
    Object node = adaptor.create(tokenType, tokenText);
    if (value != null) {
        String[] values = value.split("\\s\\|\\s");
        for (String avalue :  values) {
            Object nodeValue = adaptor.create(CobolStructureParser.LITERAL, avalue);
            adaptor.addChild(node, nodeValue);
        }
    }
    adaptor.addChild(parent, node);
    return node;
    
}
 
开发者ID:legsem,项目名称:legstar-cob2xsd,代码行数:27,代码来源:ASTReferenceGraph.java

示例2: buildJDBCUrl

import org.antlr.runtime.tree.TreeAdaptor; //导入方法依赖的package包/类
public Object buildJDBCUrl(TreeAdaptor adaptor, String dbType, String hostname, String port, String dbname) {
	StringBuilder buf = new StringBuilder();
	buf.append("'");
	buf.append("jdbc:");
	if (dbType == null) 
		throw new ParserException(Pass.FIRST, "Malformed jdbc url: missing dbtype");
	buf.append(dbType).append("://");
	if (hostname == null)
		throw new ParserException(Pass.FIRST, "Malformed jdbc url: missing host");
	buf.append(hostname);
	if (port != null) 
		buf.append(":").append(port);
	if (dbname != null)
		buf.append("/").append(dbname);
	buf.append("'");
	return adaptor.create(TokenTypes.Character_String_Literal, buf.toString());
}
 
开发者ID:Tesora,项目名称:tesora-dve-pub,代码行数:18,代码来源:Utils.java

示例3: buildKeywordEscapeIdentifier

import org.antlr.runtime.tree.TreeAdaptor; //导入方法依赖的package包/类
public Object buildKeywordEscapeIdentifier(TreeAdaptor adaptor, Object tree) {
	if (tree instanceof CommonToken) {
		Token tok = (Token) tree;
    	return adaptor.create(TokenTypes.Regular_Identifier, tok, tok.getText());    		
	} else {
		CommonTree ct = (CommonTree)tree;
		return adaptor.create(TokenTypes.Regular_Identifier, ct.getToken(), ct.getText());
	}
}
 
开发者ID:Tesora,项目名称:tesora-dve-pub,代码行数:10,代码来源:Utils.java

示例4: buildIdentifier

import org.antlr.runtime.tree.TreeAdaptor; //导入方法依赖的package包/类
public Object buildIdentifier(Parser parser, TreeAdaptor adaptor, String text) {
	return adaptor.create(TokenTypes.Regular_Identifier, text);
}
 
开发者ID:Tesora,项目名称:tesora-dve-pub,代码行数:4,代码来源:Utils.java

示例5: makeTinyTree

import org.antlr.runtime.tree.TreeAdaptor; //导入方法依赖的package包/类
public Object makeTinyTree(TreeAdaptor adaptor, Token ct) {
	return adaptor.create(ct);
}
 
开发者ID:Tesora,项目名称:tesora-dve-pub,代码行数:4,代码来源:Utils.java


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