BeetlAntlrErrorStrategy.java 文件源码

java
阅读 22 收藏 0 点赞 0 评论 0

项目:beetl2.0 作者:
/** Make sure we don't attempt to recover inline; if the parser
    * successfully recovers, it won't throw an exception.
    */
    @Override
    public Token recoverInline(Parser recognizer) throws RecognitionException
    {
        // SINGLE TOKEN DELETION
        Token matchedSymbol = singleTokenDeletion(recognizer);
        if (matchedSymbol != null)
        {
            // we have deleted the extra token.
            // now, move past ttype token as if all were ok
            recognizer.consume();
            return matchedSymbol;
        }

        // SINGLE TOKEN INSERTION
        if (singleTokenInsertion(recognizer))
        {
            return getMissingSymbol(recognizer);
        }

//      BeetlException exception = new BeetlParserException(BeetlException.PARSER_MISS_ERROR);
//      exception.pushToken(this.getGrammarToken(recognizer.getCurrentToken()));
//      throw exception;
        throw new InputMismatchException(recognizer);
    }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号