Package org.antlr.runtime

Examples of org.antlr.runtime.MismatchedTokenException


     */
    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(
                                 DroolsParserExceptionFactory.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( DRLLexer.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

      m = errorPrefix + nvae.grammarDecisionDescription;
      reportProblem(line, m, st, et);
    } else if (re instanceof MismatchedTokenException) {

      errorPrefix = "Mismatched Input: ";
      MismatchedTokenException mte = (MismatchedTokenException) re;
      int expecting = mte.expecting;
      String expectedToken = "";
      if (expecting > 0) {
        expectedToken = parser.getTokenNames()[expecting];
        errorPrefix = errorPrefix + "Expecting \"" + expectedToken;
View Full Code Here

        reporter.reportProblem(defaultProblem);
        problems.add(defaultProblem);
        System.out.println(messages[0] + " ### line " + ec.token.getLine());
      }
    } else if (re instanceof MismatchedTokenException) {
      MismatchedTokenException ec = (MismatchedTokenException) re;
      if (message == null || ec.token.getText() == null) {
        m = ec.toString();
      } else {
        m = "mismatched input: " + message + " : " + ec.token.getText();
      }
      // if (message == null) {
      // message = "mismatched input "
View Full Code Here

                              null,
                              DroolsEditorType.IDENTIFIER );
            if ( state.failed ) return null;
            return StringUtils.unescapeJava( safeStripStringDelimiters( id.getText() ) );
        } else {
            throw new MismatchedTokenException( DRLLexer.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

                              null,
                              DroolsEditorType.IDENTIFIER );
            if ( state.failed ) return null;
            return StringUtils.unescapeJava( safeStripStringDelimiters( id.getText() ) );
        } else {
            throw new MismatchedTokenException( DRLLexer.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

                              null,
                              DroolsEditorType.IDENTIFIER );
            if ( state.failed ) return null;
            return StringUtils.unescapeJava( safeStripStringDelimiters( id.getText() ) );
        } else {
            throw new MismatchedTokenException( DRLLexer.ID,
                                                input );
        }
    }
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.