Package org.antlr.runtime

Examples of org.antlr.runtime.RecognitionException


    protected Token recoverFromMismatchedToken( TokenStream input,
                                                int ttype,
                                                String text,
                                                int[] follow )
                                                              throws RecognitionException {
        RecognitionException e = null;
        // if next token is what we are looking for then "delete" this token
        if ( mismatchIsUnwantedToken( input,
                                      ttype,
                                      text ) ) {
            e = new UnwantedTokenException( ttype,
View Full Code Here


    protected Token recoverFromMismatchedToken(TokenStream input,
            int ttype,
            String text,
            int[] follow)
            throws RecognitionException {
        RecognitionException e = null;
        // if next token is what we are looking for then "delete" this token
        if (mismatchIsUnwantedToken(input,
                ttype,
                text)) {
            e = new UnwantedTokenException(ttype,
View Full Code Here

      String lineS = elements[3];
      String posS = elements[4];
      Class excClass = null;
      try {
        excClass = Class.forName(excName);
        RecognitionException e =
          (RecognitionException)excClass.newInstance();
        e.index = Integer.parseInt(indexS);
        e.line = Integer.parseInt(lineS);
        e.charPositionInLine = Integer.parseInt(posS);
        listener.recognitionException(e);
View Full Code Here

                tokenName = tokenNames[mte.expecting];
            }
            msg = "Mismatched input. Expecting \"" + tokenName + "\", got \"" + mte.token.getText()
                    + "\" at " + getTokenLocation(mte);
        } else if (e instanceof RecognitionException){
            RecognitionException re = (RecognitionException) e;
            msg = "Encountered \"" + re.token.getText() + "\" at " + getTokenLocation(re);
        } else if (e instanceof UnknownFunctionException) {
            UnknownFunctionException ufe = (UnknownFunctionException) e;
            msg = "Unknown function: \"" + ufe.getFuncName() + "\".";
        } else {
View Full Code Here

        assertEquals("unexpected errors: "+equeue, 1, equeue.errors.size());

        int expectedMsgID = ErrorManager.MSG_WILDCARD_AS_ROOT;
        Object expectedArg = null;
        RecognitionException expectedExc = null;
        GrammarSyntaxMessage expectedMessage =
            new GrammarSyntaxMessage(expectedMsgID, g, null, expectedArg, expectedExc);

        checkError(equeue, expectedMessage);       
    }
View Full Code Here

        super(message, cause);
    }

    public ParsingException(String message)
    {
        this(message, new RecognitionException(new ANTLRStringStream()));
    }
View Full Code Here

            markOtherErrors( markers, drlInfo.getBuilderErrors() );
        } catch ( DroolsParserException e ) {
            // we have an error thrown from DrlParser
            Throwable cause = e.getCause();
            if ( cause instanceof RecognitionException ) {
                RecognitionException recogErr = (RecognitionException) cause;
                markers.add( new DroolsBuildMarker( recogErr.getMessage(),
                                                    recogErr.line ) ); //flick back the line number
            }
        } catch ( DecisionTableParseException e ) {
            if ( !"No RuleTable's were found in spreadsheet.".equals( e.getMessage() ) ) {
                throw e;
View Full Code Here

                             drlInfo.getBuilderErrors() );
        } catch ( DroolsParserException e ) {
            // we have an error thrown from DrlParser
            Throwable cause = e.getCause();
            if ( cause instanceof RecognitionException ) {
                RecognitionException recogErr = (RecognitionException) cause;
                markers.add( new DroolsBuildMarker( recogErr.getMessage(),
                                                    recogErr.line ) ); //flick back the line number
            }
        } catch ( Exception t ) {
            String message = t.getMessage();
            if ( message == null || message.trim().equals( "" ) ) {
View Full Code Here

                             drlInfo.getBuilderErrors() );
        } catch ( DroolsParserException e ) {
            // we have an error thrown from DrlParser
            Throwable cause = e.getCause();
            if ( cause instanceof RecognitionException ) {
                RecognitionException recogErr = (RecognitionException) cause;
                markers.add( new DroolsBuildMarker( recogErr.getMessage(),
                                                    recogErr.line ) ); //flick back the line number
            }
        } catch ( DecisionTableParseException e ) {
            if ( !"No RuleTable's were found in spreadsheet.".equals( e.getMessage() ) ) {
                throw e;
View Full Code Here

                             drlInfo.getBuilderErrors() );
        } catch ( DroolsParserException e ) {
            // we have an error thrown from DrlParser
            Throwable cause = e.getCause();
            if ( cause instanceof RecognitionException ) {
                RecognitionException recogErr = (RecognitionException) cause;
                markers.add( new DroolsBuildMarker( recogErr.getMessage(),
                                                    recogErr.line ) ); //flick back the line number
            }
        } catch ( Exception t ) {
            String message = t.getMessage();
            if ( message == null || message.trim().equals( "" ) ) {
View Full Code Here

TOP

Related Classes of org.antlr.runtime.RecognitionException

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.