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

KleeParseTreeWalker.java 文件源码 项目:green-solver 阅读 29 收藏 0 点赞 0 评论 0
public void walk(ParseTreeListener listener, ParseTree t) {
    if ( t instanceof ErrorNode) {
        listener.visitErrorNode((ErrorNode)t);
        return;
    }
    else if ( t instanceof TerminalNode) {
        listener.visitTerminal((TerminalNode)t);
        return;
    }
    RuleNode r = (RuleNode)t;
    enterRule(listener, r);
    int n = r.getChildCount();
    for (int i = 0; i<n; i++) {
        walk(listener, r.getChild(i));
    }
    exitRule(listener, r);

}
TqlExpressionVisitor.java 文件源码 项目:daikon 阅读 22 收藏 0 点赞 0 评论 0
@Override
public TqlElement visitFieldContains(TqlParser.FieldContainsContext ctx) {
    LOG.debug("Visit field contains: " + ctx.getText());
    TerminalNode field = ctx.getChild(TerminalNode.class, 0);
    TqlElement fieldName = field.accept(this);
    TerminalNode valueNode = ctx.getChild(TerminalNode.class, 2);

    if (valueNode instanceof ErrorNode)
        throw new TqlException(valueNode.getText());

    String quotedValue = valueNode.getSymbol().getText();
    String value = quotedValue.substring(1, quotedValue.length() - 1);
    FieldContainsExpression fieldContainsExpression = new FieldContainsExpression(fieldName, value);
    LOG.debug("End visit field contains: " + ctx.getText());
    return fieldContainsExpression;
}
TqlExpressionVisitor.java 文件源码 项目:daikon 阅读 20 收藏 0 点赞 0 评论 0
@Override
public TqlElement visitFieldMatchesRegexp(TqlParser.FieldMatchesRegexpContext ctx) {
    LOG.debug("Visit field matches: " + ctx.getText());
    TerminalNode field = ctx.getChild(TerminalNode.class, 0);
    TqlElement fieldName = field.accept(this);
    TerminalNode regexNode = ctx.getChild(TerminalNode.class, 2);

    if (regexNode instanceof ErrorNode)
        throw new TqlException(regexNode.getText());

    String quotedRegex = regexNode.getSymbol().getText();
    String regex = quotedRegex.substring(1, quotedRegex.length() - 1);
    FieldMatchesRegex fieldMatchesRegex = new FieldMatchesRegex(fieldName, regex);
    LOG.debug("End visit field matches: " + ctx.getText());
    return fieldMatchesRegex;
}
CypherCstToAstVisitor.java 文件源码 项目:memory-graph 阅读 21 收藏 0 点赞 0 评论 0
@Override
public CypherAstBase visitErrorNode(ErrorNode node) {
    throw new MemgraphException(String.format(
            "Could not parse: invalid value \"%s\" (line: %d, pos: %d)",
            node.getText(),
            node.getSymbol().getLine(),
            node.getSymbol().getCharPositionInLine()
    ));
}
QueryVisitorImpl.java 文件源码 项目:CacheStore 阅读 17 收藏 0 点赞 0 评论 0
/**
     * {@inheritDoc}
     *
     * <p>The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.</p>
     */
//    @Override public Result visitNumbers(@NotNull QueryParser.NumbersContext ctx) {
//        return new Result( Result.Type.NUMBER, ctx.getText());
//    }


    @Override
    public Result visitErrorNode(@NotNull ErrorNode errorNode) {
        return null;
    }
CursorContextListener.java 文件源码 项目:ftc 阅读 19 收藏 0 点赞 0 评论 0
@Override
public void visitErrorNode(ErrorNode node) {
    super.visitErrorNode(node);
    if (!isGenericError(node.getText()))
        recognize(node.getSymbol(), getStop(node));

    addErrorToken(node);
    debugErrorNode(node);
}
ProgramExtractor.java 文件源码 项目:Simulizer 阅读 26 收藏 0 点赞 0 评论 0
@Override
public void visitErrorNode(ErrorNode node) {
    if(node.getSymbol().getCharPositionInLine() != -1) {
        int line = node.getSymbol().getLine();
        int rangeStart = node.getSymbol().getStartIndex();
        int rangeEnd = node.getSymbol().getStopIndex();

        log.logProblem("Error node: \"" + node.getText() + "\"", line, rangeStart, rangeEnd, Problem.Severity.CRITICAL);
    } else {
        log.logProblem("Error node with no position information: \"" + node.getText() + "\"", Problem.NO_LINE_NUM, Problem.Severity.CRITICAL);
    }
}
IndexRQL.java 文件源码 项目:indexr 阅读 21 收藏 0 点赞 0 评论 0
private static <T> T checkNode(ParseTree node, Class<T> clazz) {
    if (node instanceof ErrorNode) {
        throw new IndexRQLParseError(node.getText());
    } else if (node instanceof TerminalNode) {
        return null;
    } else if (clazz.isInstance(node)) {
        return (T) node;
    }
    return null;
}
TeradataTreeListener.java 文件源码 项目:Teradata-SQL-Parser 阅读 17 收藏 0 点赞 0 评论 0
@Override
    public void visitErrorNode(ErrorNode node) {
//        if (builder.length() > 0) {
//            builder.append(' ');
//        }
//
//        builder.append(Utils.escapeWhitespace(Trees.getNodeText(node, ruleNames), false));
//        builder.append(System.lineSeparator());
    }
ParseTreePretty.java 文件源码 项目:TSS 阅读 19 收藏 0 点赞 0 评论 0
@Override
public void visitErrorNode(ErrorNode node) {
    if (builder.length() > 0) {
        builder.append(' ');
    }

    builder.append(Utils.escapeWhitespace(Trees.getNodeText(node, ruleNames), false));
}
CypherCstToAstVisitor.java 文件源码 项目:vertexium 阅读 19 收藏 0 点赞 0 评论 0
@Override
public CypherAstBase visitErrorNode(ErrorNode node) {
    throw new VertexiumException(String.format(
            "Could not parse: invalid value \"%s\" (line: %d, pos: %d)",
            node.getText(),
            node.getSymbol().getLine(),
            node.getSymbol().getCharPositionInLine()
    ));
}
LoggingListener.java 文件源码 项目:rpgleparser 阅读 35 收藏 0 点赞 0 评论 0
@Override
public void visitErrorNode(ErrorNode node) {
    if (logger.isDebugEnabled()) {
        logger.debug("visitErrorNode(ErrorNode) - start"); //$NON-NLS-1$
    }

    super.visitErrorNode(node);

    if (logger.isDebugEnabled()) {
        logger.debug("visitErrorNode(ErrorNode) - end"); //$NON-NLS-1$
    }
}
AbstractPQLQuery.java 文件源码 项目:PQL 阅读 25 收藏 0 点赞 0 评论 0
protected String getNodeText(Tree tree, List<String> ruleNames) {
    if (ruleNames != null) {
        if(tree instanceof RuleNode) {
            int ruleIndex = ((RuleNode)tree).getRuleContext().getRuleIndex();
            String ruleName = (String)ruleNames.get(ruleIndex);
            return ruleName;
        }

        if(tree instanceof ErrorNode)
            return tree.toString();

        if(tree instanceof TerminalNode) {
            Token symbol = ((TerminalNode)tree).getSymbol();
            if(symbol != null) {
                String s = symbol.getText();
                return s;
            }
        }
    }

    Object payload = tree.getPayload();

    if(payload instanceof Token)
        return ((Token)payload).getText();
    else
        return tree.getPayload().toString();
}
TqlExpressionVisitor.java 文件源码 项目:daikon 阅读 20 收藏 0 点赞 0 评论 0
@Override
public TqlElement visitFieldCompliesPattern(TqlParser.FieldCompliesPatternContext ctx) {
    LOG.debug("Visit field complies: " + ctx.getText());
    TqlElement fieldName = ctx.getChild(0).accept(this);
    ParseTree patternNode = ctx.getChild(2);

    if (patternNode instanceof ErrorNode)
        throw new TqlException(patternNode.getText());

    String quotedPattern = patternNode.getText();
    String pattern = quotedPattern.substring(1, quotedPattern.length() - 1);
    FieldCompliesPattern fieldCompliesPattern = new FieldCompliesPattern(fieldName, pattern);
    LOG.debug("End visit field complies: " + ctx.getText());
    return fieldCompliesPattern;
}
TqlExpressionVisitor.java 文件源码 项目:daikon 阅读 20 收藏 0 点赞 0 评论 0
@Override
public TqlElement visitFieldIn(TqlParser.FieldInContext ctx) {
    LOG.debug("Visit field in: " + ctx.getText());
    TerminalNode field = ctx.getChild(TerminalNode.class, 0);
    TqlElement fieldName = field.accept(this);
    // All children which are not terminal values are the needed literal values (see syntax)
    LiteralValue[] literalValues = ctx.children.stream().filter(c -> c instanceof TqlParser.LiteralValueContext
            || c instanceof TqlParser.BooleanValueContext || c instanceof ErrorNode).map(c -> (LiteralValue) c.accept(this))
            .toArray(LiteralValue[]::new);
    FieldInExpression fieldIn = new FieldInExpression(fieldName, literalValues);
    LOG.debug("End visit field in: " + ctx.getText());
    return fieldIn;
}
LoggingListener.java 文件源码 项目:dragoman 阅读 20 收藏 0 点赞 0 评论 0
@Override
public void visitErrorNode(ErrorNode node) {
  super.visitErrorNode(node);
  logger.debug("visitErrorNode: " + node.getText());
}
MyListener2.java 文件源码 项目:SQLParser 阅读 19 收藏 0 点赞 0 评论 0
@Override
public void visitErrorNode(ErrorNode arg0) {
    Logger.log(Logger.DEBUG, "visitErrorNode" + arg0.getText());

}
MyListener.java 文件源码 项目:SQLParser 阅读 19 收藏 0 点赞 0 评论 0
@Override
public void visitErrorNode(ErrorNode arg0) {
    Logger.log(Logger.DEBUG, "visitErrorNode" + arg0.getText());

}
AntlrParser.java 文件源码 项目:pgcodekeeper 阅读 23 收藏 0 点赞 0 评论 0
@Override
public void visitErrorNode(ErrorNode node) {
    //no imp
}
TreeWalkListener.java 文件源码 项目:athena 阅读 17 收藏 0 点赞 0 评论 0
@Override
public void visitErrorNode(ErrorNode errorNode) {
    // do nothing.
}
ArabicPrologBaseListener.java 文件源码 项目:Mujeed-Arabic-Prolog 阅读 17 收藏 0 点赞 0 评论 0
public void visitErrorNode(@NotNull ErrorNode node) { 
    System.out.println(node.getText());
}
ElasticSearchVisitor.java 文件源码 项目:elasticsearch-jdbc 阅读 17 收藏 0 点赞 0 评论 0
@Override
public ParserResult visitErrorNode(ErrorNode node) {
    throw new UnsupportedOperationException("Error would be thrown by ThrowingExceptionErrorStrategy");
}
ObjectQueryVisitorImpl.java 文件源码 项目:CacheStore 阅读 14 收藏 0 点赞 0 评论 0
@Override
public Result visitErrorNode(@NotNull ErrorNode errorNode) {
    return null;
}
DefaultTreeListener.java 文件源码 项目:inmemantlr 阅读 23 收藏 0 点赞 0 评论 0
@Override
public void visitErrorNode(ErrorNode errorNode) {
}
DefaultListener.java 文件源码 项目:inmemantlr 阅读 18 收藏 0 点赞 0 评论 0
@Override
public void visitErrorNode(ErrorNode errorNode) {
}
TriALQLClassListener.java 文件源码 项目:TriAL-QL-Engine 阅读 17 收藏 0 点赞 0 评论 0
@Override
public void visitErrorNode(ErrorNode arg0) {
    // TODO Auto-generated method stub

}
MetagenBuilder.java 文件源码 项目:metagen-java 阅读 15 收藏 0 点赞 0 评论 0
@Override
public void visitErrorNode(ErrorNode errorNode) {
    super.visitErrorNode(errorNode);
    errorNodes.add(errorNode);
}
MetagenBuilder.java 文件源码 项目:metagen-java 阅读 19 收藏 0 点赞 0 评论 0
public List<ErrorNode> getErrorNodes() {
    return errorNodes;
}
SyntaxElementListener.java 文件源码 项目:ftc 阅读 19 收藏 0 点赞 0 评论 0
@Override
public void visitErrorNode(ErrorNode node) {
    if (!isGenericError(node.getText()))
        addElement(node.getSymbol(), SyntaxElementType.error);
}
CursorContextListener.java 文件源码 项目:ftc 阅读 19 收藏 0 点赞 0 评论 0
private void addErrorToken(ErrorNode node) {
    errorTokensRead.add(node.getSymbol());
    allErrorTokensRead.add(node.getSymbol());
}


问题


面经


文章

微信
公众号

扫码关注公众号