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


Java Tree.getText方法代码示例

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


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

示例1: equalsByTree

import org.antlr.runtime.tree.Tree; //导入方法依赖的package包/类
@Override
public boolean equalsByTree(Tree tree) {
	if (tree == null)
		return false;
	String op = tree.getText();
	if (op == null)
		return false;
	if (!op.equalsIgnoreCase(fnName))
		return false;
	if (tree.getChildCount() != inputs.size())
		return false;
	for (int i = 0; i < inputs.size(); ++i) {
		Column c = inputs.get(i);
		if (!c.getInfo().equalsByTree(tree.getChild(i)))
			return false;
	}
	return true;
}
 
开发者ID:prup,项目名称:data-lawyer,代码行数:19,代码来源:ColumnMetadata.java

示例2: getText

import org.antlr.runtime.tree.Tree; //导入方法依赖的package包/类
static private String getText(Tree node)
{
    String text = node.getText();
    int index;
    switch (node.getType())
    {
    case CMIS_FTSParser.FTSWORD:
        index = text.indexOf('\\');
        if (index == -1)
        {
            return text;
        }
        else
        {
            return unescape(text);
        }
    case CMIS_FTSParser.FTSPHRASE:
        String phrase = text.substring(1, text.length() - 1);
        index = phrase.indexOf('\\');
        if (index == -1)
        {
            return phrase;
        }
        else
        {
            return unescape(phrase);
        }
    default:
        return text;
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:32,代码来源:CMISFTSQueryParser.java

示例3: registerPersisterSpace

import org.antlr.runtime.tree.Tree; //导入方法依赖的package包/类
@Override
public void registerPersisterSpace(Tree entityName, Tree alias) {
	String put = entityNameByAlias.put( alias.getText(), entityName.getText() );
	if ( put != null && !put.equalsIgnoreCase( entityName.getText() ) ) {
		throw new UnsupportedOperationException(
				"Alias reuse currently not supported: alias " + alias.getText()
				+ " already assigned to type " + put );
	}
	propertyHelper.registerEntityAlias( entityName.getText(), alias.getText() );
}
 
开发者ID:hibernate,项目名称:hibernate-ogm-ignite,代码行数:11,代码来源:IgniteQueryResolverDelegate.java

示例4: normalizeQualifiedRoot

import org.antlr.runtime.tree.Tree; //导入方法依赖的package包/类
@Override
public PathedPropertyReferenceSource normalizeQualifiedRoot(Tree root) {
	String entityNameForAlias = entityNameByAlias.get( root.getText() );

	if ( entityNameForAlias == null ) {
		throw log.getUnknownAliasException( root.getText() );
	}

	return new PathedPropertyReference( root.getText(), null, true );
}
 
开发者ID:hibernate,项目名称:hibernate-ogm-ignite,代码行数:11,代码来源:IgniteQueryResolverDelegate.java

示例5: getDefaultFieldText

import org.antlr.runtime.tree.Tree; //导入方法依赖的package包/类
private String getDefaultFieldText(Tree tree) throws QueryParseException {
    String val = tree.getChild(0).toString();
    if (val.startsWith("\"") && val.endsWith("\"") && val.length() >= 2) {
        val = val.substring(1, val.length() - 1);
    }
    if (!isValidExpression(val)) {
        throw new QueryParseException("Invalid query at " +
                tree.getCharPositionInLine() + ": " + tree.getText());
    }
    return Query.sanitizeValue(val);
}
 
开发者ID:jruesga,项目名称:rview,代码行数:12,代码来源:ChangeQuery.java

示例6: parseAgg

import org.antlr.runtime.tree.Tree; //导入方法依赖的package包/类
private static Relation parseAgg(Relation input, Tree select_subtree,
		Tree having_subtree) throws DataLawyerException {
	if (!select_subtree.getText().equalsIgnoreCase("select"))
		throw DataLawyerException.incorrectParseTree("select");
	if (having_subtree != null)
		if (!having_subtree.getText().equalsIgnoreCase("having"))
			throw DataLawyerException.incorrectParseTree("having");

	ArrayList<Tree> aggregations = getAggregations(select_subtree);
	if (having_subtree != null)
		aggregations.addAll(getAggregations(having_subtree));

	Relation output = input;

	// Unlike parseWhere, there might not be any aggregated column.
	if (aggregations.size() > 0) {
		output = new OpAgg(input);
		for (Tree aggregate : aggregations) {
			// We might end up adding duplicate columns (for example through
			// the having clause and through the select clause).
			if (output.getColumn(aggregate) == null) {
				String operation_string = aggregate.getText();
				Column input_col_id = getNewColumnIfRequired(input,
						aggregate.getChild(0));
				ColumnOptMetadata optinfo = input
						.getColumnOptInfo(input_col_id);
				UnaryOperation operation = Operation.getUnary(
						operation_string, input_col_id);
				((OpAgg) output).addOperation(operation, optinfo);
			}
		}
	}

	return output;
}
 
开发者ID:prup,项目名称:data-lawyer,代码行数:36,代码来源:ParserWrapper.java

示例7: translateLiteral

import org.antlr.runtime.tree.Tree; //导入方法依赖的package包/类
public Expression<?> translateLiteral(Tree n) {
  Type<?> type = null;
  switch(n.getType()) {
  case BYTE_LITERAL:
    type = BuiltinTypes.SINT8;
    break;
  case SHORT_LITERAL:
    type = BuiltinTypes.SINT16;
    break;
  case INT_LITERAL:
    type = BuiltinTypes.SINT32;
    break;
  case LONG_LITERAL:
    type = BuiltinTypes.SINT64;
    break;
  case FLOAT_LITERAL:
    type = BuiltinTypes.FLOAT;
    break;
  case DOUBLE_LITERAL:
    type = BuiltinTypes.DOUBLE;
    break;
  case BIGINT_LITERAL:
    type = BuiltinTypes.INTEGER;
    break;
  case BIGDECIMAL_LITERAL:
    type = BuiltinTypes.DECIMAL;
    break;
  default:
    throw new UnexpectedTokenException(n, BYTE_LITERAL, SHORT_LITERAL, INT_LITERAL, LONG_LITERAL, FLOAT_LITERAL, DOUBLE_LITERAL, BIGINT_LITERAL, BIGDECIMAL_LITERAL);  
  }
  
  String txt = n.getText();
  int lastIdx = txt.length() - 1;
  char last = txt.charAt(lastIdx);
  if(!Character.isDigit(last))
    txt = txt.substring(0, lastIdx);
  
  return Constant.createParsed(type, txt);
}
 
开发者ID:psycopaths,项目名称:jconstraints,代码行数:40,代码来源:ASTTranslator.java

示例8: translateIdentifier

import org.antlr.runtime.tree.Tree; //导入方法依赖的package包/类
public String translateIdentifier(Tree n) {
  switch(n.getType()) {
  case ExpressionParser.ID:
    return n.getText();
  case ExpressionParser.QID:
    String txt = n.getText();
    // TODO : unescape quotes
    return txt.substring(1, txt.length() - 1);
  }
  throw new UnexpectedTokenException(n, ExpressionParser.ID, ExpressionParser.QID);
}
 
开发者ID:psycopaths,项目名称:jconstraints,代码行数:12,代码来源:ASTTranslator.java

示例9: translateType

import org.antlr.runtime.tree.Tree; //导入方法依赖的package包/类
public Type<?> translateType(Tree n) {
  requireType(n, ExpressionParser.ID);
  String name = n.getText();
  Type<?> type = types.byName(name);
  if(type == null)
    throw new UnknownTypeException(n);
  return type;
}
 
开发者ID:psycopaths,项目名称:jconstraints,代码行数:9,代码来源:ASTTranslator.java

示例10: getText

import org.antlr.runtime.tree.Tree; //导入方法依赖的package包/类
static private String getText(Tree node, boolean returnTextFromUnknownNodes)
{
    String text = node.getText();
    int index;
    switch (node.getType())
    {
    case FTSParser.FTSWORD:
    case FTSParser.FTSPRE:
    case FTSParser.FTSWILD:
        index = text.indexOf('\\');
        if (index == -1)
        {
            return text;
        }
        else
        {
            return unescape(text);
        }
    case FTSParser.FTSPHRASE:
        String phrase = text.substring(1, text.length() - 1);
        index = phrase.indexOf('\\');
        if (index == -1)
        {
            return phrase;
        }
        else
        {
            return unescape(phrase);
        }
    case FTSParser.ID:
        index = text.indexOf('\\');
        if (index == -1)
        {
            return ISO9075.decode(text);
        }
        else
        {
            return ISO9075.decode(unescape(text));
        }
    case FTSParser.URI:
    case FTSParser.OR:
    case FTSParser.AND:
    case FTSParser.NOT:
    case FTSParser.TILDA:
    case FTSParser.PLUS:
    case FTSParser.MINUS:
    case FTSParser.COLON:
    case FTSParser.STAR:
    case FTSParser.DOTDOT:
    case FTSParser.DOT:
    case FTSParser.AMP:
    case FTSParser.EXCLAMATION:
    case FTSParser.BAR:
    case FTSParser.EQUALS:
    case FTSParser.QUESTION_MARK:
    case FTSParser.TO:
    case FTSParser.COMMA:
    case FTSParser.CARAT:
    case FTSParser.DOLLAR:
    case FTSParser.AT:
    case FTSParser.PERCENT:
    case FTSParser.DECIMAL_INTEGER_LITERAL:
    case FTSParser.FLOATING_POINT_LITERAL:
    case FTSParser.DATETIME:
        return text;
    default:
        if(returnTextFromUnknownNodes)
        {
            return text;
        }
        else
        {
            return "";
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:77,代码来源:FTSQueryParser.java

示例11: normalizeUnqualifiedPropertyReference

import org.antlr.runtime.tree.Tree; //导入方法依赖的package包/类
@Override
public PathedPropertyReferenceSource normalizeUnqualifiedPropertyReference(Tree property) {
	return new PathedPropertyReference( property.getText(), null, isAlias( property ) );
}
 
开发者ID:hibernate,项目名称:hibernate-ogm-ignite,代码行数:5,代码来源:IgniteQueryResolverDelegate.java

示例12: normalizeUnqualifiedRoot

import org.antlr.runtime.tree.Tree; //导入方法依赖的package包/类
@Override
public PathedPropertyReferenceSource normalizeUnqualifiedRoot(Tree root) {
	return new PathedPropertyReference( root.getText(), null, isAlias( root ) );
}
 
开发者ID:hibernate,项目名称:hibernate-ogm-ignite,代码行数:5,代码来源:IgniteQueryResolverDelegate.java

示例13: normalizePropertyPathIntermediary

import org.antlr.runtime.tree.Tree; //导入方法依赖的package包/类
@Override
public PathedPropertyReferenceSource normalizePropertyPathIntermediary(PropertyPath path, Tree propertyName) {
	return new PathedPropertyReference( propertyName.getText(), null, false );
}
 
开发者ID:hibernate,项目名称:hibernate-ogm-ignite,代码行数:5,代码来源:IgniteQueryResolverDelegate.java

示例14: normalizePropertyPathTerminus

import org.antlr.runtime.tree.Tree; //导入方法依赖的package包/类
@Override
public PathedPropertyReferenceSource normalizePropertyPathTerminus(PropertyPath path, Tree propertyNameNode) {
	return new PathedPropertyReference( propertyNameNode.getText(), null, false );
}
 
开发者ID:hibernate,项目名称:hibernate-ogm-ignite,代码行数:5,代码来源:IgniteQueryResolverDelegate.java

示例15: pushFromStrategy

import org.antlr.runtime.tree.Tree; //导入方法依赖的package包/类
@Override
public void pushFromStrategy(JoinType joinType, Tree assosiationFetchTree, Tree propertyFetchTree, Tree alias) {
	this.currentAlias = alias.getText();
}
 
开发者ID:hibernate,项目名称:hibernate-ogm-ignite,代码行数:5,代码来源:IgniteQueryResolverDelegate.java


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