java类org.antlr.v4.runtime.tree.TerminalNode的实例源码

XQueryEvaluator.java 文件源码 项目:xquery-engine 阅读 22 收藏 0 点赞 0 评论 0
/**
 * 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;
}
FormalPropertySyntaxTreeToAstTranslator.java 文件源码 项目:BEAST 阅读 20 收藏 0 点赞 0 评论 0
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);
}
CypherCstToAstVisitor.java 文件源码 项目:memory-graph 阅读 24 收藏 0 点赞 0 评论 0
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;
}
Visitor.java 文件源码 项目:ts-swift-transpiler 阅读 23 收藏 0 点赞 0 评论 0
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;
}
PrettyPrinter.java 文件源码 项目:Tarski 阅读 36 收藏 0 点赞 0 评论 0
@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());
}
SentencePrinter.java 文件源码 项目:Tarski 阅读 44 收藏 0 点赞 0 评论 0
@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);
}
CypherParser.java 文件源码 项目:cyp2sql 阅读 21 收藏 0 点赞 0 评论 0
public TerminalNode SP(int i) {
    return getToken(CypherParser.SP, i);
}
CypherParser.java 文件源码 项目:cyp2sql 阅读 22 收藏 0 点赞 0 评论 0
public TerminalNode SP(int i) {
    return getToken(CypherParser.SP, i);
}
SqlGrammarParser.java 文件源码 项目:coherence-sql 阅读 50 收藏 0 点赞 0 评论 0
public TerminalNode NUMBER() {
    return getToken(SqlGrammarParser.NUMBER, 0);
}
CypherParser.java 文件源码 项目:cyp2sql 阅读 22 收藏 0 点赞 0 评论 0
public TerminalNode SP(int i) {
    return getToken(CypherParser.SP, i);
}
SqlGrammarParser.java 文件源码 项目:coherence-sql 阅读 25 收藏 0 点赞 0 评论 0
public TerminalNode MAXDOP() {
    return getToken(SqlGrammarParser.MAXDOP, 0);
}
SqlGrammarParser.java 文件源码 项目:coherence-sql 阅读 23 收藏 0 点赞 0 评论 0
public TerminalNode GROUPING_ID() {
    return getToken(SqlGrammarParser.GROUPING_ID, 0);
}
SqlGrammarParser.java 文件源码 项目:coherence-sql 阅读 22 收藏 0 点赞 0 评论 0
public TerminalNode PRECEDING() {
    return getToken(SqlGrammarParser.PRECEDING, 0);
}
SqlGrammarParser.java 文件源码 项目:coherence-sql 阅读 20 收藏 0 点赞 0 评论 0
public TerminalNode GROUPING() {
    return getToken(SqlGrammarParser.GROUPING, 0);
}
SqlGrammarParser.java 文件源码 项目:coherence-sql 阅读 22 收藏 0 点赞 0 评论 0
public TerminalNode UNKNOWN() {
    return getToken(SqlGrammarParser.UNKNOWN, 0);
}
SqlGrammarParser.java 文件源码 项目:coherence-sql 阅读 23 收藏 0 点赞 0 评论 0
public TerminalNode CATCH() {
    return getToken(SqlGrammarParser.CATCH, 0);
}
CypherParser.java 文件源码 项目:cyp2sql 阅读 20 收藏 0 点赞 0 评论 0
public TerminalNode NOT(int i) {
    return getToken(CypherParser.NOT, i);
}
CypherParser.java 文件源码 项目:cyp2sql 阅读 20 收藏 0 点赞 0 评论 0
public TerminalNode SP(int i) {
    return getToken(CypherParser.SP, i);
}
SqlGrammarParser.java 文件源码 项目:coherence-sql 阅读 27 收藏 0 点赞 0 评论 0
public TerminalNode FULLSCAN() {
    return getToken(SqlGrammarParser.FULLSCAN, 0);
}
SqlGrammarParser.java 文件源码 项目:coherence-sql 阅读 22 收藏 0 点赞 0 评论 0
public TerminalNode JOIN() {
    return getToken(SqlGrammarParser.JOIN, 0);
}
SqlGrammarParser.java 文件源码 项目:coherence-sql 阅读 23 收藏 0 点赞 0 评论 0
public TerminalNode SUM() {
    return getToken(SqlGrammarParser.SUM, 0);
}
SqlGrammarParser.java 文件源码 项目:coherence-sql 阅读 22 收藏 0 点赞 0 评论 0
public TerminalNode KEEPFIXED() {
    return getToken(SqlGrammarParser.KEEPFIXED, 0);
}
CParser.java 文件源码 项目:BEAST 阅读 21 收藏 0 点赞 0 评论 0
public TerminalNode StringLiteral(int i) {
    return getToken(CParser.StringLiteral, i);
}
CypherParser.java 文件源码 项目:cyp2sql 阅读 20 收藏 0 点赞 0 评论 0
public TerminalNode SP(int i) {
    return getToken(CypherParser.SP, i);
}
SqlGrammarParser.java 文件源码 项目:coherence-sql 阅读 24 收藏 0 点赞 0 评论 0
public TerminalNode COOKIE() {
    return getToken(SqlGrammarParser.COOKIE, 0);
}
SqlGrammarParser.java 文件源码 项目:coherence-sql 阅读 61 收藏 0 点赞 0 评论 0
public TerminalNode MAX() {
    return getToken(SqlGrammarParser.MAX, 0);
}
Vex.java 文件源码 项目:pgcodekeeper 阅读 18 收藏 0 点赞 0 评论 0
public TerminalNode leftParen() {
    return isB ? vexB.LEFT_PAREN() : vex.LEFT_PAREN();
}
CypherParser.java 文件源码 项目:cyp2sql 阅读 24 收藏 0 点赞 0 评论 0
public TerminalNode WITH(int i) {
    return getToken(CypherParser.WITH, i);
}
LoggingListener.java 文件源码 项目:dragoman 阅读 21 收藏 0 点赞 0 评论 0
@Override
public void visitTerminal(TerminalNode node) {
  super.visitTerminal(node);
  logger.debug("visitTerminal: " + node.getText());
}
SqlGrammarParser.java 文件源码 项目:coherence-sql 阅读 27 收藏 0 点赞 0 评论 0
public TerminalNode KEEP() {
    return getToken(SqlGrammarParser.KEEP, 0);
}


问题


面经


文章

微信
公众号

扫码关注公众号