當前位置: 首頁>>代碼示例>>Java>>正文


Java TerminalNode類代碼示例

本文整理匯總了Java中org.antlr.v4.runtime.tree.TerminalNode的典型用法代碼示例。如果您正苦於以下問題:Java TerminalNode類的具體用法?Java TerminalNode怎麽用?Java TerminalNode使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


TerminalNode類屬於org.antlr.v4.runtime.tree包,在下文中一共展示了TerminalNode類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: keyNodeTags

import org.antlr.v4.runtime.tree.TerminalNode; //導入依賴的package包/類
/**
 * Calculates the key of a node - only depends on the values of the nodes in the tag list
 *
 * @param node Node to compute the key of
 * @param tags List of tags of the node the key depends on
 * @return Key of the node
 */
public static String keyNodeTags(Node node, List<TerminalNode> tags) {
    String key = "";
    NodeList nodes = node.getChildNodes();
    for (TerminalNode tag : tags) {
        for (int i = 0; i < nodes.getLength(); ++i) {
            Node c = nodes.item(i);
            if (c.getNodeName().equals(tag.getText())) {
                try {
                    key += IO.NodesToString(children(c), false);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
    }
    return key;
}
 
開發者ID:jsidrach,項目名稱:xquery-engine,代碼行數:25,代碼來源:XQueryEvaluator.java

示例2: exitVoteSum

import org.antlr.v4.runtime.tree.TerminalNode; //導入依賴的package包/類
private void exitVoteSum(final String exprStr, final TerminalNode tn, final boolean unique) {
    String numberString = tn.getText().substring(exprStr.length());
    int number = Integer.valueOf(numberString);
    if (number > maxVoteExp) {
        maxVoteExp = number;
    }
    VoteSumForCandExp expNode = new VoteSumForCandExp(number, expStack.pop(), unique);
    expStack.push(expNode);
}
 
開發者ID:Skypr,項目名稱:BEAST,代碼行數:10,代碼來源:FormalPropertySyntaxTreeToAstTranslator.java

示例3: toBinaryExpressions

import org.antlr.v4.runtime.tree.TerminalNode; //導入依賴的package包/類
private <T extends ParseTree> CypherBinaryExpression toBinaryExpressions(List<ParseTree> children, Function<T, CypherAstBase> itemTransform) {
    CypherAstBase left = null;
    CypherBinaryExpression.Op op = null;
    for (int i = 0; i < children.size(); i++) {
        ParseTree child = children.get(i);
        if (child instanceof TerminalNode) {
            CypherBinaryExpression.Op newOp = CypherBinaryExpression.Op.parseOrNull(child.getText());
            if (newOp != null) {
                if (op == null) {
                    op = newOp;
                } else {
                    throw new MemgraphException("unexpected op, found too many ops in a row");
                }
            }
        } else {
            //noinspection unchecked
            CypherAstBase childObj = itemTransform.apply((T) child);
            if (left == null) {
                left = childObj;
            } else {
                if (op == null) {
                    throw new MemgraphException("unexpected binary expression. expected an op between expressions");
                }
                left = new CypherBinaryExpression(left, op, childObj);
            }
            op = null;
        }
    }
    return (CypherBinaryExpression) left;
}
 
開發者ID:mware-solutions,項目名稱:memory-graph,代碼行數:31,代碼來源:CypherCstToAstVisitor.java

示例4: visitChildren

import org.antlr.v4.runtime.tree.TerminalNode; //導入依賴的package包/類
public String visitChildren(RuleNode node, List<Integer> withoutNodes) {
    if(node == null) return "";
    String result = this.defaultResult();
    int n = node.getChildCount();

    for(int i = 0; i < n && this.shouldVisitNextChild(node, result); ++i) {
        if(withoutNodes != null && withoutNodes.contains(i)) continue;
        ParseTree c = node.getChild(i);
        String childResult = c instanceof TerminalNode ? printTerminalNode((TerminalNode) c) : c.accept(this);
        result = this.aggregateResult(result, childResult);
    }

    return result;
}
 
開發者ID:marcelganczak,項目名稱:ts-swift-transpiler,代碼行數:15,代碼來源:Visitor.java

示例5: visitQuantification

import org.antlr.v4.runtime.tree.TerminalNode; //導入依賴的package包/類
@Override
public String visitQuantification(final QuantificationContext ctx) {
  String str = "";
  str += ctx.quantifier().op.getText().toLowerCase() + " ";

  final List<TerminalNode> identifierList = ctx.quantifier().IDENTIFIER();
  for (int i = 0; i < identifierList.size() - 1; i++) {
    str += identifierList.get(i).getText() + ", ";
  }
  str += identifierList.get(identifierList.size() - 1).getText() + " ";

  return str + " | " + this.visit(ctx.expr());
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:14,代碼來源:PrettyPrinter.java

示例6: visitQuantification

import org.antlr.v4.runtime.tree.TerminalNode; //導入依賴的package包/類
@Override
public String visitQuantification(QuantificationContext ctx) {
  String str = "";
  str += ctx.quantifier().op.getText().toLowerCase() + " ";

  List<TerminalNode> identifierList = ctx.quantifier().IDENTIFIER();
  for (int i = 0; i < identifierList.size() - 1; i++) {
    str += identifierList.get(i).getText() + ", ";
  }
  str += identifierList.get(identifierList.size() - 1).getText() + " ";

  return str + " | " + this.visit(ctx.scope);
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:14,代碼來源:SentencePrinter.java

示例7: SP

import org.antlr.v4.runtime.tree.TerminalNode; //導入依賴的package包/類
public TerminalNode SP(int i) {
    return getToken(CypherParser.SP, i);
}
 
開發者ID:DTG-FRESCO,項目名稱:cyp2sql,代碼行數:4,代碼來源:CypherParser.java

示例8: NUMBER

import org.antlr.v4.runtime.tree.TerminalNode; //導入依賴的package包/類
public TerminalNode NUMBER() {
	return getToken(SqlGrammarParser.NUMBER, 0);
}
 
開發者ID:michalwojciechowski,項目名稱:coherence-sql,代碼行數:4,代碼來源:SqlGrammarParser.java

示例9: MAXDOP

import org.antlr.v4.runtime.tree.TerminalNode; //導入依賴的package包/類
public TerminalNode MAXDOP() {
	return getToken(SqlGrammarParser.MAXDOP, 0);
}
 
開發者ID:michalwojciechowski,項目名稱:coherence-sql,代碼行數:4,代碼來源:SqlGrammarParser.java

示例10: GROUPING_ID

import org.antlr.v4.runtime.tree.TerminalNode; //導入依賴的package包/類
public TerminalNode GROUPING_ID() {
	return getToken(SqlGrammarParser.GROUPING_ID, 0);
}
 
開發者ID:michalwojciechowski,項目名稱:coherence-sql,代碼行數:4,代碼來源:SqlGrammarParser.java

示例11: PRECEDING

import org.antlr.v4.runtime.tree.TerminalNode; //導入依賴的package包/類
public TerminalNode PRECEDING() {
	return getToken(SqlGrammarParser.PRECEDING, 0);
}
 
開發者ID:michalwojciechowski,項目名稱:coherence-sql,代碼行數:4,代碼來源:SqlGrammarParser.java

示例12: GROUPING

import org.antlr.v4.runtime.tree.TerminalNode; //導入依賴的package包/類
public TerminalNode GROUPING() {
	return getToken(SqlGrammarParser.GROUPING, 0);
}
 
開發者ID:michalwojciechowski,項目名稱:coherence-sql,代碼行數:4,代碼來源:SqlGrammarParser.java

示例13: UNKNOWN

import org.antlr.v4.runtime.tree.TerminalNode; //導入依賴的package包/類
public TerminalNode UNKNOWN() {
	return getToken(SqlGrammarParser.UNKNOWN, 0);
}
 
開發者ID:michalwojciechowski,項目名稱:coherence-sql,代碼行數:4,代碼來源:SqlGrammarParser.java

示例14: CATCH

import org.antlr.v4.runtime.tree.TerminalNode; //導入依賴的package包/類
public TerminalNode CATCH() {
	return getToken(SqlGrammarParser.CATCH, 0);
}
 
開發者ID:michalwojciechowski,項目名稱:coherence-sql,代碼行數:4,代碼來源:SqlGrammarParser.java

示例15: NOT

import org.antlr.v4.runtime.tree.TerminalNode; //導入依賴的package包/類
public TerminalNode NOT(int i) {
    return getToken(CypherParser.NOT, i);
}
 
開發者ID:DTG-FRESCO,項目名稱:cyp2sql,代碼行數:4,代碼來源:CypherParser.java


注:本文中的org.antlr.v4.runtime.tree.TerminalNode類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。