Package antlr

Examples of antlr.MismatchedTokenException


                return;
            }
        }
        else if (ex instanceof MismatchedTokenException)
        {
            MismatchedTokenException mismatched = (MismatchedTokenException)ex;
            Token token = mismatched.token;
            if ((mismatched.mismatchType == MismatchedTokenException.TOKEN) &&
                (token != null))
            {
                if (token.getType() == Token.EOF_TYPE) {
View Full Code Here


     * {@link ASParser#identifier()}.
     * @return missing identifier
     */
    protected IdentifierNode expectingIdentifier(NoViableAltException ex)
    {
        final MismatchedTokenException mismatchedTokenException = new MismatchedTokenException(
                new String[] {"IDENTIFIER"},
                ex.token,
                ASTokenTypes.TOKEN_IDENTIFIER,
                false,
                ex.fileName);
View Full Code Here

    if ( token instanceof HqlToken ) {
      HqlToken hqlToken = ( HqlToken ) token;
      // ... and the token could be an identifer and the error is
      // a mismatched token error ...
      if ( hqlToken.isPossibleID() && ( ex instanceof MismatchedTokenException ) ) {
        MismatchedTokenException mte = ( MismatchedTokenException ) ex;
        // ... and the expected token type was an identifier, then:
        if ( mte.expecting == HqlTokenTypes.IDENT ) {
          // Use the token as an identifier.
          reportWarning( "Keyword  '"
              + token.getText()
              + "' is being interpreted as an identifier due to: " + mte.getMessage() );
          // Add the token to the AST.
          ASTPair currentAST = new ASTPair();
          token.setType( HqlTokenTypes.WEIRD_IDENT );
          astFactory.addASTChild( currentAST, astFactory.create( token ) );
          consume();
View Full Code Here

        AST __t12 = _t;
        GrammarAST tmp6_AST_in = (GrammarAST)_t;
        match(_t,OPTIONS);
        _t = _t.getFirstChild();
        GrammarAST tmp7_AST_in = (GrammarAST)_t;
        if ( _t==null ) throw new MismatchedTokenException();
        _t = _t.getNextSibling();
        _t = __t12;
        _t = _t.getNextSibling();
        break;
      }
      case TOKENS:
      case RULE:
      case SCOPE:
      case AMPERSAND:
      {
        break;
      }
      default:
      {
        throw new NoViableAltException(_t);
      }
      }
      }
      {
      if (_t==null) _t=ASTNULL;
      switch ( _t.getType()) {
      case TOKENS:
      {
        AST __t14 = _t;
        GrammarAST tmp8_AST_in = (GrammarAST)_t;
        match(_t,TOKENS);
        _t = _t.getFirstChild();
        GrammarAST tmp9_AST_in = (GrammarAST)_t;
        if ( _t==null ) throw new MismatchedTokenException();
        _t = _t.getNextSibling();
        _t = __t14;
        _t = _t.getNextSibling();
        break;
      }
View Full Code Here

        AST __t12 = _t;
        GrammarAST tmp5_AST_in = (GrammarAST)_t;
        match(_t,OPTIONS);
        _t = _t.getFirstChild();
        GrammarAST tmp6_AST_in = (GrammarAST)_t;
        if ( _t==null ) throw new MismatchedTokenException();
        _t = _t.getNextSibling();
        _t = __t12;
        _t = _t.getNextSibling();
        break;
      }
      case TOKENS:
      case RULE:
      case SCOPE:
      case IMPORT:
      case AMPERSAND:
      {
        break;
      }
      default:
      {
        throw new NoViableAltException(_t);
      }
      }
      }
      {
      if (_t==null) _t=ASTNULL;
      switch ( _t.getType()) {
      case IMPORT:
      {
        AST __t14 = _t;
        GrammarAST tmp7_AST_in = (GrammarAST)_t;
        match(_t,IMPORT);
        _t = _t.getFirstChild();
        GrammarAST tmp8_AST_in = (GrammarAST)_t;
        if ( _t==null ) throw new MismatchedTokenException();
        _t = _t.getNextSibling();
        _t = __t14;
        _t = _t.getNextSibling();
        break;
      }
      case TOKENS:
      case RULE:
      case SCOPE:
      case AMPERSAND:
      {
        break;
      }
      default:
      {
        throw new NoViableAltException(_t);
      }
      }
      }
      {
      if (_t==null) _t=ASTNULL;
      switch ( _t.getType()) {
      case TOKENS:
      {
        AST __t16 = _t;
        GrammarAST tmp9_AST_in = (GrammarAST)_t;
        match(_t,TOKENS);
        _t = _t.getFirstChild();
        GrammarAST tmp10_AST_in = (GrammarAST)_t;
        if ( _t==null ) throw new MismatchedTokenException();
        _t = _t.getNextSibling();
        _t = __t16;
        _t = _t.getNextSibling();
        break;
      }
View Full Code Here

        AST __t33 = _t;
        GrammarAST tmp21_AST_in = (GrammarAST)_t;
        match(_t,OPTIONS);
        _t = _t.getFirstChild();
        GrammarAST tmp22_AST_in = (GrammarAST)_t;
        if ( _t==null ) throw new MismatchedTokenException();
        _t = _t.getNextSibling();
        _t = __t33;
        _t = _t.getNextSibling();
        break;
      }
View Full Code Here

        AST __t12 = _t;
        GrammarAST tmp5_AST_in = (GrammarAST)_t;
        match(_t,OPTIONS);
        _t = _t.getFirstChild();
        GrammarAST tmp6_AST_in = (GrammarAST)_t;
        if ( _t==null ) throw new MismatchedTokenException();
        _t = _t.getNextSibling();
        _t = __t12;
        _t = _t.getNextSibling();
        break;
      }
      case TOKENS:
      case RULE:
      case SCOPE:
      case AMPERSAND:
      {
        break;
      }
      default:
      {
        throw new NoViableAltException(_t);
      }
      }
      }
      {
      if (_t==null) _t=ASTNULL;
      switch ( _t.getType()) {
      case TOKENS:
      {
        AST __t14 = _t;
        GrammarAST tmp7_AST_in = (GrammarAST)_t;
        match(_t,TOKENS);
        _t = _t.getFirstChild();
        GrammarAST tmp8_AST_in = (GrammarAST)_t;
        if ( _t==null ) throw new MismatchedTokenException();
        _t = _t.getNextSibling();
        _t = __t14;
        _t = _t.getNextSibling();
        break;
      }
View Full Code Here

        AST __t31 = _t;
        GrammarAST tmp19_AST_in = (GrammarAST)_t;
        match(_t,OPTIONS);
        _t = _t.getFirstChild();
        GrammarAST tmp20_AST_in = (GrammarAST)_t;
        if ( _t==null ) throw new MismatchedTokenException();
        _t = _t.getNextSibling();
        _t = __t31;
        _t = _t.getNextSibling();
        break;
      }
View Full Code Here

        AST __t12 = _t;
        GrammarAST tmp6_AST_in = (GrammarAST)_t;
        match(_t,OPTIONS);
        _t = _t.getFirstChild();
        GrammarAST tmp7_AST_in = (GrammarAST)_t;
        if ( _t==null ) throw new MismatchedTokenException();
        _t = _t.getNextSibling();
        _t = __t12;
        _t = _t.getNextSibling();
        break;
      }
      case TOKENS:
      case RULE:
      case SCOPE:
      case IMPORT:
      case AMPERSAND:
      {
        break;
      }
      default:
      {
        throw new NoViableAltException(_t);
      }
      }
      }
      {
      if (_t==null) _t=ASTNULL;
      switch ( _t.getType()) {
      case IMPORT:
      {
        AST __t14 = _t;
        GrammarAST tmp8_AST_in = (GrammarAST)_t;
        match(_t,IMPORT);
        _t = _t.getFirstChild();
        GrammarAST tmp9_AST_in = (GrammarAST)_t;
        if ( _t==null ) throw new MismatchedTokenException();
        _t = _t.getNextSibling();
        _t = __t14;
        _t = _t.getNextSibling();
        break;
      }
      case TOKENS:
      case RULE:
      case SCOPE:
      case AMPERSAND:
      {
        break;
      }
      default:
      {
        throw new NoViableAltException(_t);
      }
      }
      }
      {
      if (_t==null) _t=ASTNULL;
      switch ( _t.getType()) {
      case TOKENS:
      {
        AST __t16 = _t;
        GrammarAST tmp10_AST_in = (GrammarAST)_t;
        match(_t,TOKENS);
        _t = _t.getFirstChild();
        GrammarAST tmp11_AST_in = (GrammarAST)_t;
        if ( _t==null ) throw new MismatchedTokenException();
        _t = _t.getNextSibling();
        _t = __t16;
        _t = _t.getNextSibling();
        break;
      }
View Full Code Here

    if ( token instanceof HqlToken ) {
      HqlToken hqlToken = ( HqlToken ) token;
      // ... and the token could be an identifer and the error is
      // a mismatched token error ...
      if ( hqlToken.isPossibleID() && ( ex instanceof MismatchedTokenException ) ) {
        MismatchedTokenException mte = ( MismatchedTokenException ) ex;
        // ... and the expected token type was an identifier, then:
        if ( mte.expecting == HqlTokenTypes.IDENT ) {
          // Use the token as an identifier.
          reportWarning( "Keyword  '"
              + token.getText()
              + "' is being interpreted as an identifier due to: " + mte.getMessage() );
          // Add the token to the AST.
          ASTPair currentAST = new ASTPair();
          token.setType( HqlTokenTypes.WEIRD_IDENT );
          astFactory.addASTChild( currentAST, astFactory.create( token ) );
          consume();
View Full Code Here

TOP

Related Classes of antlr.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.