Package org.antlr.runtime

Examples of org.antlr.runtime.MismatchedTokenException


            }
            buf.append(c);
            consume();
      if ( c==EOF ) {
        RecognitionException re =
          new MismatchedTokenException((int)'"', input);
        re.line = input.getLine();
        re.charPositionInLine = input.getCharPositionInLine();
        errMgr.lexerError(input.getSourceName(), "EOF in string", templateToken, re);
        break;
      }
View Full Code Here


    Token COMMENT() {
        match('!');
        while ( !(c=='!' && input.LA(2)==delimiterStopChar) ) {
      if (c==EOF) {
        RecognitionException re =
          new MismatchedTokenException((int)'!', input);
        re.line = input.getLine();
        re.charPositionInLine = input.getCharPositionInLine();
        errMgr.lexerError(input.getSourceName(), "Nonterminated comment starting at " +
          startLine+":"+startCharPositionInLine+": '!"+
          delimiterStopChar+"' missing", templateToken, re);
View Full Code Here

     */
    private List<String> createErrorMessage(RecognitionException e) {
        List<String> codeAndMessage = new ArrayList<String>(2);
        String message = "";
        if (e instanceof MismatchedTokenException) {
            MismatchedTokenException mte = (MismatchedTokenException) e;
            if (tokenNames != null && mte.expecting >= 0 && mte.expecting < tokenNames.length) {
                message = String
                        .format(
                                DroolsParserExceptionFactory.MISMATCHED_TOKEN_MESSAGE_COMPLETE,
                                e.line, e.charPositionInLine,
View Full Code Here

   */
  private List<String> createErrorMessage(RecognitionException e) {
    List<String> codeAndMessage = new ArrayList<String>(2);
    String message = "";
    if (e instanceof MismatchedTokenException) {
      MismatchedTokenException mte = (MismatchedTokenException) e;
      if (mte.expecting >= 0 && mte.expecting < tokenNames.length) {
        message = String
            .format(
                DroolsParserExceptionFactory.MISMATCHED_TOKEN_MESSAGE_COMPLETE,
                e.line, e.charPositionInLine,
View Full Code Here

           public String createErrorMessage(RecognitionException e)
            {
        StringBuffer message = new StringBuffer();   
                    message.append( source + ":"+e.line+":"+e.charPositionInLine+" ");
                    if ( e instanceof MismatchedTokenException ) {
                            MismatchedTokenException mte = (MismatchedTokenException)e;
                            message.append("mismatched token: "+
                                                               e.token+
                                                               "; expecting type "+
                                                               tokenNames[mte.expecting]);
                    }
View Full Code Here

                    DroolsEditorType.IDENTIFIER);
            if (state.failed)
                return null;
            return StringUtils.unescapeJava(safeStripStringDelimiters(id.getText()));
        } else {
            throw new MismatchedTokenException(DRL6Lexer.ID,
                    input);
        }
    }
View Full Code Here

        if (text != null) {
            e = new DroolsMismatchedTokenException(ttype,
                    text,
                    input);
        } else {
            e = new MismatchedTokenException(ttype,
                    input);
        }
        throw e;
    }
View Full Code Here

     */
    private List<String> createErrorMessage( RecognitionException e ) {
        List<String> codeAndMessage = new ArrayList<String>( 2 );
        String message;
        if ( e instanceof MismatchedTokenException ) {
            MismatchedTokenException mte = (MismatchedTokenException) e;
            String expecting = mte instanceof DroolsMismatchedTokenException ? ((DroolsMismatchedTokenException)mte).getTokenText() : getBetterToken( mte.expecting );
            if ( tokenNames != null && mte.expecting >= 0 && mte.expecting < tokenNames.length ) {
                message = String
                        .format(
                                 MISMATCHED_TOKEN_MESSAGE_COMPLETE,
View Full Code Here

                              null,
                              DroolsEditorType.IDENTIFIER );
            if ( state.failed ) return null;
            return StringUtils.unescapeJava( safeStripStringDelimiters( id.getText() ) );
        } else {
            throw new MismatchedTokenException( DRL5Lexer.ID,
                                                input );
        }
    }
View Full Code Here

        if ( text != null ) {
            e = new DroolsMismatchedTokenException( ttype,
                                                    text,
                                                    input );
        } else {
            e = new MismatchedTokenException( ttype,
                                              input );
        }
        throw e;
    }
View Full Code Here

TOP

Related Classes of org.antlr.runtime.MismatchedTokenException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.