本文整理了Java中org.antlr.runtime.tree.Tree.getTokenStartIndex()
方法的一些代码示例,展示了Tree.getTokenStartIndex()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tree.getTokenStartIndex()
方法的具体详情如下:
包路径:org.antlr.runtime.tree.Tree
类名称:Tree
方法名:getTokenStartIndex
[英]What is the smallest token index (indexing from 0) for this node and its children?
[中]此节点及其子节点的最小令牌索引(从0开始索引)是什么?
代码示例来源:origin: apache/hive
private void setQueryHints(QB qb) throws SemanticException {
QBParseInfo qbp = getQBParseInfo(qb);
String selClauseName = qbp.getClauseNames().iterator().next();
Tree selExpr0 = qbp.getSelForClause(selClauseName).getChild(0);
if (selExpr0.getType() != HiveParser.QUERY_HINT) return;
String hint = ctx.getTokenRewriteStream().toString(
selExpr0.getTokenStartIndex(), selExpr0.getTokenStopIndex());
LOG.debug("Handling query hints: " + hint);
ParseDriver pd = new ParseDriver();
try {
ASTNode hintNode = pd.parseHint(hint);
qbp.setHints(hintNode);
} catch (ParseException e) {
throw new SemanticException("failed to parse query hint: "+e.getMessage(), e);
}
}
代码示例来源:origin: antlr/antlr3
@Override
public int getTokenStartIndex(Object t) {
if ( t==null ) return -1;
return ((Tree)t).getTokenStartIndex();
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.antlr-runtime
@Override
public int getTokenStartIndex(Object t) {
if ( t==null ) return -1;
return ((Tree)t).getTokenStartIndex();
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
@Override
public int getTokenStartIndex(Object t) {
if ( t==null ) return -1;
return ((Tree)t).getTokenStartIndex();
}
代码示例来源:origin: antlr/antlr3
@Override
public int getTokenStartIndex(Object t) {
if ( t==null ) return -1;
return ((Tree)t).getTokenStartIndex();
}
代码示例来源:origin: io.virtdata/virtdata-lib-realer
@Override
public int getTokenStartIndex(Object t) {
if ( t==null ) return -1;
return ((Tree)t).getTokenStartIndex();
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
public int getTokenStartIndex(Object t) {
if ( t==null ) return -1;
return ((Tree)t).getTokenStartIndex();
}
代码示例来源:origin: org.apache.chemistry.opencmis/chemistry-opencmis-server-support
public void addWhereTypeReference(Tree node, String qualifier) {
if (node != null) {
typeReferences.put(node.getTokenStartIndex(), qualifier);
}
}
代码示例来源:origin: org.apache.chemistry.opencmis/chemistry-opencmis-server-support
public void addJoinReference(Tree node, CmisSelector reference) {
columnReferences.put(node.getTokenStartIndex(), reference);
joinReferences.add(reference);
}
代码示例来源:origin: org.apache.chemistry.opencmis/chemistry-opencmis-server-support
public void addSelectReference(Tree node, CmisSelector selRef) {
selectReferences.add(selRef);
columnReferences.put(node.getTokenStartIndex(), selRef);
}
代码示例来源:origin: org.apache.chemistry.opencmis/chemistry-opencmis-server-support
public void addSortCriterium(Tree node, ColumnReference colRef, boolean ascending) {
if (LOG.isDebugEnabled()) {
LOG.debug("addSortCriterium: {} ascending: {}", colRef, ascending);
}
columnReferences.put(node.getTokenStartIndex(), colRef);
sortSpecs.add(new SortSpec(node.getTokenStartIndex(), ascending));
}
代码示例来源:origin: org.apache.chemistry.opencmis/chemistry-opencmis-server-support
public void addWhereReference(Tree node, CmisSelector reference) {
if (LOG.isDebugEnabled()) {
LOG.debug("add node to where: {}", System.identityHashCode(node));
}
columnReferences.put(node.getTokenStartIndex(), reference);
whereReferences.add(reference);
}
代码示例来源:origin: org.antlr/antlr4
: alt.ast;
if (rootNode.getTokenStartIndex() == -1) {
continue; // ignore autogenerated tokens from combined grammars that start with T__
代码示例来源:origin: FeatureIDE/FeatureIDE
private void parseModel(final Tree root) throws RecognitionException {
final LinkedList<Tree> nodeList = getChildren(root);
while (!nodeList.isEmpty()) {
final Tree curNode = nodeList.poll();
switch (curNode.getType()) {
case VelvetParser.CONCEPT:
parseConcept(curNode);
break;
case VelvetParser.CINTERFACE:
extFeatureModel.setInterface(true);
parseConcept(curNode);
break;
case VelvetParser.EOF:
if (curNode.getTokenStartIndex() > -1) {
break;
}
default:
reportSyntaxError(curNode);
}
}
}
代码示例来源:origin: com.tunnelvisionlabs/antlr4
: alt.ast;
if (rootNode.getTokenStartIndex() == -1) {
continue; // ignore autogenerated tokens from combined grammars that start with T__
代码示例来源:origin: io.virtdata/virtdata-lib-realer
: alt.ast;
if (rootNode.getTokenStartIndex() == -1) {
continue; // ignore autogenerated tokens from combined grammars that start with T__
代码示例来源:origin: uk.co.nichesolutions/antlr4
List<GrammarAST> labeledSubTrees = t.getNodesWithType(new IntervalSet(ASSIGN,PLUS_ASSIGN));
for (GrammarAST sub : labeledSubTrees) {
noOptions.add(sub.getChild(0).getTokenStartIndex());
代码示例来源:origin: com.tunnelvisionlabs/antlr4
List<GrammarAST> labeledSubTrees = t.getNodesWithType(new IntervalSet(ASSIGN,PLUS_ASSIGN));
for (GrammarAST sub : labeledSubTrees) {
noOptions.add(sub.getChild(0).getTokenStartIndex());
代码示例来源:origin: FeatureIDE/FeatureIDE
break;
case VelvetParser.EOF:
if (curNode.getTokenStartIndex() > -1) {
break;
代码示例来源:origin: FeatureIDE/FeatureIDE
break;
case VelvetParser.EOF:
if (curNode.getTokenStartIndex() > -1) {
break;
内容来源于网络,如有侵权,请联系作者删除!