Package org.antlr.runtime

Examples of org.antlr.runtime.RecognitionException


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

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

    this.srcName = srcName;
  }

  @Override
  public String toString() {
    RecognitionException re = (RecognitionException)cause;
    int line = re.line;
    int charPos = re.charPositionInLine;
    if ( templateToken!=null ) {
      int templateDelimiterSize = 1;
      if ( templateToken.getType()== GroupParser.BIGSTRING ) {
View Full Code Here

            else if ( name.equals("super") ) return newToken(SUPER);
            else if ( name.equals("true") ) return newToken(TRUE);
            else if ( name.equals("false") ) return newToken(FALSE);
            return id;
          }
          RecognitionException re =
            new NoViableAltException("",0,0,input);
                    re.line = startLine;
                    re.charPositionInLine = startCharPositionInLine;
          errMgr.lexerError(input.getSourceName(), "invalid character '"+str(c)+"'", templateToken, re);
          if (c==EOF) {
View Full Code Here

                continue;
            }
            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+": '!"+
View Full Code Here

    void LINEBREAK() {
        match('\\'); // only kill 2nd \ as ESCAPE() kills first one
        match(delimiterStopChar);
        while ( c==' ' || c=='\t' ) consume(); // scarf WS after <\\>
    if ( c==EOF ) {
      RecognitionException re = new RecognitionException(input);
      re.line = input.getLine();
      re.charPositionInLine = input.getCharPositionInLine();
      errMgr.lexerError(input.getSourceName(), "Missing newline after newline escape <\\\\>",
                      templateToken, re);
      return;
View Full Code Here

    this.srcName = srcName;
  }

  @Override
  public String toString() {
        RecognitionException re = (RecognitionException)cause;
    int line = 0;
    int charPos = -1;
    if ( token!=null ) {
      line = token.getLine();
      charPos = token.getCharPositionInLine();
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.