本文整理汇总了Java中org.antlr.runtime.tree.CommonTree.getText方法的典型用法代码示例。如果您正苦于以下问题:Java CommonTree.getText方法的具体用法?Java CommonTree.getText怎么用?Java CommonTree.getText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.antlr.runtime.tree.CommonTree
的用法示例。
在下文中一共展示了CommonTree.getText方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertNode
import org.antlr.runtime.tree.CommonTree; //导入方法依赖的package包/类
private static Object convertNode(CommonTree node, DatabaseDialect dialect) {
switch (node.getType()) {
case SQLLexer.CREATE_TABLE: return convertCreateTable(node, dialect);
case SQLLexer.DROP_TABLE: return convertDropTable(node);
case SQLLexer.ALTER_TABLE: return convertAlterTable(node);
case SQLLexer.CREATE_SEQUENCE: return convertCreateSequence(node);
case SQLLexer.DROP_SEQUENCE: return convertDropSequence(node);
case SQLLexer.CREATE_INDEX: return convertCreateIndex(node);
case SQLLexer.COMMENT_TABLE: return convertTableComment(node);
case SQLLexer.COMMENT_COLUMN: return convertColumnComment(node);
}
if (node.isNil()) {
List<Object> nodes = convertNodes(getChildNodes(node), dialect);
return nodes.toArray();
}
throw new ParseException("Unknown token type", "'" + node.getText() + "'");
}
示例2: recursivelyFixWindowFucntion
import org.antlr.runtime.tree.CommonTree; //导入方法依赖的package包/类
public static void recursivelyFixWindowFucntion(
CommonTree srcTree) {
if (srcTree.getChildCount() == 0) { return; }
// process node
String text = srcTree.getText();
System.out.println("Currently processed node==> " + text);
if (text.equals(PARTITION_BY)) {
return;
} else if (text.equals(ORDER_BY)) {
if (srcTree.getChildCount() == 0) {
if (srcTree.getParent() != null) {
// found a matching node
srcTree.getParent().deleteChild(srcTree.getChildIndex());
srcTree.getParent().freshenParentAndChildIndexes();
}
}
return;
}
// process children
for (Tree t : children(srcTree)) {
recursivelyFixWindowFucntion((CommonTree)t);
}
}
示例3: buildFTSTest
import org.antlr.runtime.tree.CommonTree; //导入方法依赖的package包/类
static private Constraint buildFTSTest(CommonTree argNode, QueryModelFactory factory, FunctionEvaluationContext functionEvaluationContext,
Selector selector, Map<String, Column> columnMap, String defaultField)
{
CommonTree testNode = argNode;
switch (testNode.getType())
{
case CMIS_FTSParser.DISJUNCTION:
case CMIS_FTSParser.CONJUNCTION:
return buildFTSConnective(testNode, factory, functionEvaluationContext, selector, columnMap, defaultField);
case CMIS_FTSParser.TERM:
return buildTerm(testNode, factory, functionEvaluationContext, selector, columnMap);
case CMIS_FTSParser.PHRASE:
return buildPhrase(testNode, factory, functionEvaluationContext, selector, columnMap);
default:
throw new FTSQueryException("Unsupported FTS option " + testNode.getText());
}
}
示例4: convertExpressionNode
import org.antlr.runtime.tree.CommonTree; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
private static Expression convertExpressionNode(CommonTree node) {
switch (node.getType()) {
case SQLLexer.OR: return convertOr(node);
case SQLLexer.AND: return convertAnd(node);
case SQLLexer.XOR: return convertXor(node);
case SQLLexer.EQ: return convertEq(node);
case SQLLexer.BANGEQ: return convertBangEq(node);
case SQLLexer.LTGT: return convertBangEq(node); // <>
case SQLLexer.GT: return convertGt(node);
case SQLLexer.GE: return convertGe(node);
case SQLLexer.LT: return convertLt(node);
case SQLLexer.LE: return convertLe(node);
case SQLLexer.IS: return convertIs(node);
case SQLLexer.NOT: return convertNot(node);
case SQLLexer.NULL: return convertNull(node);
case SQLLexer.LIKE: return convertLike(node);
case SQLLexer.IN: return convertIn(node);
case SQLLexer.BETWEEN: return convertBetween(node);
case SQLLexer.PLUS: return convertPlus(node);
case SQLLexer.SUB: return convertSub(node);
case SQLLexer.STAR: return convertStar(node);
case SQLLexer.SLASH: return convertSlash(node);
case SQLLexer.PERCENT: return convertPercent(node);
case SQLLexer.BARBAR: return convertBarBar(node);
case SQLLexer.INVOCATION: return convertInvocation(node);
case SQLLexer.QUOTED_NAME: return convertQuotedName(node);
case SQLLexer.IDENTIFIER: return convertIdentifier(node);
case SQLLexer.STRING: return convertStringToExpression(node);
case SQLLexer.INT: return convertInt(node);
default: throw new ParseException("Unknown token type (" + node.getType() + ")", "'" + node.getText() + "'");
}
}
示例5: createNode
import org.antlr.runtime.tree.CommonTree; //导入方法依赖的package包/类
private HostNode createNode(DefaultHostGraph graph, CommonTree tree) {
HostNode result = graph.addNode();
int tokenType = tree.getType();
graph.addEdge(result,
TypeLabel.createLabel(EdgeRole.NODE_TYPE, this.tokens[tokenType]),
result);
if (this.textTypes.get(tokenType) && tree.getText() != null) {
HostNode nameNode = graph.addNode(JavaStringAlgebra.instance, tree.getText());
graph.addEdge(result, TEXT_LABEL, nameNode);
}
return result;
}
示例6: convertIdentifier
import org.antlr.runtime.tree.CommonTree; //导入方法依赖的package包/类
private static Expression<String> convertIdentifier(CommonTree node) {
return new ColumnExpression(node.getText(), false);
}
示例7: convertString
import org.antlr.runtime.tree.CommonTree; //导入方法依赖的package包/类
private static String convertString(CommonTree node) {
return node.getText();
}
示例8: buildFieldReference
import org.antlr.runtime.tree.CommonTree; //导入方法依赖的package包/类
static public PropertyArgument buildFieldReference(String argumentName, CommonTree fieldReferenceNode, QueryModelFactory factory,
FunctionEvaluationContext functionEvaluationContext, Selector selector, Map<String, Column> columnMap)
{
if (fieldReferenceNode.getType() != FTSParser.FIELD_REF)
{
throw new FTSQueryException("Not column ref ..." + fieldReferenceNode.getText());
}
String fieldName = getText(fieldReferenceNode.getChild(0));
if (columnMap != null)
{
for (Column column : columnMap.values())
{
if (column.getAlias().equals(fieldName))
{
// TODO: Check selector matches ...
PropertyArgument arg = (PropertyArgument) column.getFunctionArguments().get(PropertyAccessor.ARG_PROPERTY);
fieldName = arg.getPropertyName();
break;
}
}
}
// prepend prefixes and name spaces
if (fieldReferenceNode.getChildCount() > 1)
{
CommonTree child = (CommonTree) fieldReferenceNode.getChild(1);
if (child.getType() == FTSParser.PREFIX)
{
fieldName = getText(child.getChild(0)) + ":" + fieldName;
}
else if (child.getType() == FTSParser.NAME_SPACE)
{
fieldName = getText(child.getChild(0)) + fieldName;
}
}
String alias = "";
if (selector != null)
{
functionEvaluationContext.checkFieldApplies(selector, fieldName);
alias = selector.getAlias();
}
return factory.createPropertyArgument(argumentName, functionEvaluationContext.isQueryable(fieldName), functionEvaluationContext.isOrderable(fieldName), alias, fieldName);
}