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


Java AST.setText方法代码示例

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


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

示例1: processConstant

import antlr.collections.AST; //导入方法依赖的package包/类
public void processConstant(AST constant, boolean resolveIdent) throws SemanticException {
	// If the constant is an IDENT, figure out what it means...
	boolean isIdent = ( constant.getType() == IDENT || constant.getType() == WEIRD_IDENT );
	if ( resolveIdent && isIdent && isAlias( constant.getText() ) ) {
		// IDENT is a class alias in the FROM.
		IdentNode ident = (IdentNode) constant;
		// Resolve to an identity column.
		ident.resolve( false, true );
	}
	else {
		// IDENT might be the name of a class.
		Queryable queryable = walker.getSessionFactoryHelper().findQueryableUsingImports( constant.getText() );
		if ( isIdent && queryable != null ) {
			constant.setText( queryable.getDiscriminatorSQLValue() );
		}
		// Otherwise, it's a literal.
		else {
			processLiteral( constant );
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:LiteralProcessor.java

示例2: generateScalarColumns

import antlr.collections.AST; //导入方法依赖的package包/类
/**
 * Generates the scalar column AST nodes for a given array of SQL columns
 */
public static void generateScalarColumns(HqlSqlWalkerNode node, String[] sqlColumns, int i) {
	if ( sqlColumns.length == 1 ) {
		generateSingleScalarColumn( node, i );
	}
	else {
		ASTFactory factory = node.getASTFactory();
		AST n = node;
		n.setText( sqlColumns[0] );	// Use the DOT node to emit the first column name.
		// Create the column names, folled by the column aliases.
		for ( int j = 0; j < sqlColumns.length; j++ ) {
			if ( j > 0 ) {
				n = ASTUtil.createSibling( factory, SqlTokenTypes.SQL_TOKEN, sqlColumns[j], n );
			}
			n = ASTUtil.createSibling( factory, SqlTokenTypes.SELECT_COLUMNS, " as " + NameGenerator.scalarName( i, j ), n );
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:ColumnHelper.java

示例3: handleDotStructure

import antlr.collections.AST; //导入方法依赖的package包/类
private void handleDotStructure(AST dotStructureRoot) {
	final String expression = ASTUtil.getPathText( dotStructureRoot );
	final Object constant = ReflectHelper.getConstantValue( expression );
	if ( constant != null ) {
		dotStructureRoot.setFirstChild( null );
		dotStructureRoot.setType( HqlTokenTypes.JAVA_CONSTANT );
		dotStructureRoot.setText( expression );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:QueryTranslatorImpl.java

示例4: processBoolean

import antlr.collections.AST; //导入方法依赖的package包/类
public void processBoolean(AST constant) {
	// TODO: something much better - look at the type of the other expression!
	// TODO: Have comparisonExpression and/or arithmeticExpression rules complete the resolution of boolean nodes.
	String replacement = (String) walker.getTokenReplacements().get( constant.getText() );
	if ( replacement != null ) {
		constant.setText( replacement );
	}
	else {
		boolean bool = "true".equals( constant.getText().toLowerCase() );
		Dialect dialect = walker.getSessionFactoryHelper().getFactory().getDialect();
		constant.setText( dialect.toBooleanValueString( bool ) );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:LiteralProcessor.java

示例5: processLiteral

import antlr.collections.AST; //导入方法依赖的package包/类
private void processLiteral(AST constant) {
	String replacement = (String) walker.getTokenReplacements().get( constant.getText() );
	if ( replacement != null ) {
		if ( LOG.isDebugEnabled() ) {
			LOG.debugf( "processConstant() : Replacing '%s' with '%s'", constant.getText(), replacement );
		}
		constant.setText( replacement );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:LiteralProcessor.java

示例6: processNumeric

import antlr.collections.AST; //导入方法依赖的package包/类
public void processNumeric(AST literal) {
	if ( literal.getType() == NUM_INT
			|| literal.getType() == NUM_LONG
			|| literal.getType() == NUM_BIG_INTEGER ) {
		literal.setText( determineIntegerRepresentation( literal.getText(), literal.getType() ) );
	}
	else if ( literal.getType() == NUM_FLOAT
			|| literal.getType() == NUM_DOUBLE
			|| literal.getType() == NUM_BIG_DECIMAL ) {
		literal.setText( determineDecimalRepresentation( literal.getText(), literal.getType() ) );
	}
	else {
		LOG.unexpectedLiteralTokenType( literal.getType() );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:16,代码来源:LiteralProcessor.java


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