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


            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

    }

    /** Convert the antlr exceptions to drools parser exceptions */
    private void makeErrorList(final DRLParser parser) {
        for ( final Iterator iter = parser.getErrors().iterator(); iter.hasNext(); ) {
            final RecognitionException recogErr = (RecognitionException) iter.next();
            final ParserError err = new ParserError( parser.createErrorMessage( recogErr ),
                                                     recogErr.line,
                                                     recogErr.charPositionInLine );
            this.results.add( err );
        }
View Full Code Here

            fromWindow( pattern );
        } else {
            fromExpression( pattern );
            if ( !lastTokenWasWhiteSpace() && input.LA( 1 ) == DRLLexer.EOF) {
                helper.emit( Location.LOCATION_LHS_FROM );
                throw new RecognitionException();
            }
            if ( state.failed ) return;
        }
        if ( input.LA( 1 ) == DRLLexer.SEMICOLON ) {
            match( input,
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

        final DRLParser parser = parse( name,
                                        expanded );
        parser.compilation_unit();
        assertTrue( parser.hasErrors() );

        final RecognitionException err = (RecognitionException) parser.getErrors().get( 0 );
        assertEquals( 1,
                      parser.getErrors().size() );

        assertEquals( 5,
                      err.line );
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

    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

            if ( state.failed ) return;
        } else {
            fromExpression( pattern );
            if ( !lastTokenWasWhiteSpace() && input.LA( 1 ) == DRLLexer.EOF) {
                helper.emit( Location.LOCATION_LHS_FROM );
                throw new RecognitionException();
            }
            if ( state.failed ) return;
        }
        if ( input.LA( 1 ) == DRLLexer.SEMICOLON ) {
            match( input,
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

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.