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

项目:green-solver    文件:KleeParseTreeWalker.java   
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);

}
项目:daikon    文件:TqlExpressionVisitor.java   
@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;
}
项目:daikon    文件:TqlExpressionVisitor.java   
@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;
}
项目:memory-graph    文件:CypherCstToAstVisitor.java   
@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()
    ));
}
项目:CacheStore    文件:QueryVisitorImpl.java   
/**
     * {@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;
    }
项目:ftc    文件:CursorContextListener.java   
@Override
public void visitErrorNode(ErrorNode node) {
    super.visitErrorNode(node);
    if (!isGenericError(node.getText()))
        recognize(node.getSymbol(), getStop(node));

    addErrorToken(node);
    debugErrorNode(node);
}
项目:Simulizer    文件:ProgramExtractor.java   
@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);
    }
}
项目:indexr    文件:IndexRQL.java   
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;
}
项目:Teradata-SQL-Parser    文件:TeradataTreeListener.java   
@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());
    }
项目:TSS    文件:ParseTreePretty.java   
@Override
public void visitErrorNode(ErrorNode node) {
    if (builder.length() > 0) {
        builder.append(' ');
    }

    builder.append(Utils.escapeWhitespace(Trees.getNodeText(node, ruleNames), false));
}
项目:vertexium    文件:CypherCstToAstVisitor.java   
@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()
    ));
}
项目:rpgleparser    文件:LoggingListener.java   
@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$
    }
}
项目:PQL    文件:AbstractPQLQuery.java   
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();
}
项目:daikon    文件:TqlExpressionVisitor.java   
@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;
}
项目:daikon    文件:TqlExpressionVisitor.java   
@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;
}
项目:dragoman    文件:LoggingListener.java   
@Override
public void visitErrorNode(ErrorNode node) {
  super.visitErrorNode(node);
  logger.debug("visitErrorNode: " + node.getText());
}
项目:SQLParser    文件:MyListener2.java   
@Override
public void visitErrorNode(ErrorNode arg0) {
    Logger.log(Logger.DEBUG, "visitErrorNode" + arg0.getText());

}
项目:SQLParser    文件:MyListener.java   
@Override
public void visitErrorNode(ErrorNode arg0) {
    Logger.log(Logger.DEBUG, "visitErrorNode" + arg0.getText());

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

}
项目:metagen-java    文件:MetagenBuilder.java   
@Override
public void visitErrorNode(ErrorNode errorNode) {
    super.visitErrorNode(errorNode);
    errorNodes.add(errorNode);
}
项目:metagen-java    文件:MetagenBuilder.java   
public List<ErrorNode> getErrorNodes() {
    return errorNodes;
}
项目:ftc    文件:SyntaxElementListener.java   
@Override
public void visitErrorNode(ErrorNode node) {
    if (!isGenericError(node.getText()))
        addElement(node.getSymbol(), SyntaxElementType.error);
}
项目:ftc    文件:CursorContextListener.java   
private void addErrorToken(ErrorNode node) {
    errorTokensRead.add(node.getSymbol());
    allErrorTokensRead.add(node.getSymbol());
}
项目:ftc    文件:CursorContextListener.java   
private int getStop(ErrorNode node) {
    return node.getSymbol().getStopIndex();
}
项目:ftc    文件:CursorContextListener.java   
private void debugErrorNode(ErrorNode node) {
    debugToken("Error: " + node.getText(), getBoundaries(node));
}
项目:Simulizer    文件:ValidityListener.java   
@Override
public void visitErrorNode(ErrorNode node) {
    valid = false;
}
项目:Simulizer    文件:ValidityListener.java   
@Override
public void visitTerminal(TerminalNode node) {
    valid &= !(node instanceof ErrorNode);
}
项目:codebuff    文件:CollectTokenPairs.java   
@Override
public void visitErrorNode(ErrorNode node) { }
项目:codebuff    文件:CollectSiblingLists.java   
@Override
public void visitErrorNode(ErrorNode node) {
}
项目:codebuff    文件:VisitSiblingLists.java   
@Override
public void visitErrorNode(ErrorNode node) {
}
项目:indexr    文件:AstListener.java   
@Override
public void visitErrorNode(@NotNull ErrorNode node) {
    super.visitErrorNode(node);
}
项目:AndroidEquationSolver    文件:ExpressionRenderer.java   
@Override
public String visitErrorNode(ErrorNode node) {
    mErrorFlag = true;
    return "";
}
项目:thrifty    文件:ThriftListener.java   
@Override
public void visitErrorNode(ErrorNode node) {
    errorReporter.error(locationOf(node), node.getText());
}