Package org.antlr.runtime

Examples of org.antlr.runtime.NoViableAltException


            break;
        case '%':
            alt8=25;
            break;
        default:
            NoViableAltException nvae =
                new NoViableAltException("1:1: Tokens : ( T25 | T26 | T27 | T28 | T29 | T30 | T31 | T32 | T33 | STRINGS | INTEGERS | FUNCTION | EXECUTE | SORT | ITERATE | REVERSE | ENTRY | READ | MACRO | QUOTED | IDENTIFIER | STRING | INTEGER | WS | LINE_COMMENT );", 8, 0, input);

            throw nvae;
        }

        switch (alt8) {
View Full Code Here


                break;
            case SORT:
                alt2=10;
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("16:1: commands : ( STRINGS^^ idList | INTEGERS^^ idList | FUNCTION^^ id stack | MACRO^^ id '{'! STRING '}'! | READ^^ | EXECUTE^^ '{'! function '}'! | ITERATE^^ '{'! function '}'! | REVERSE^^ '{'! function '}'! | ENTRY^^ idList0 idList0 idList0 | SORT^^ );", 2, 0, input);

                throw nvae;
            }

            switch (alt2) {
View Full Code Here

                break;
            case IDENTIFIER:
                alt5=8;
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("40:1: function : ( '<' | '>' | '=' | '+' | '-' | ':=' | '*' | identifier );", 5, 0, input);

                throw nvae;
            }

            switch (alt5) {
View Full Code Here

                break;
            case 25:
                alt7=5;
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("46:1: stackitem : ( function | STRING | INTEGER | QUOTED | stack );", 7, 0, input);

                throw nvae;
            }

            switch (alt7) {
View Full Code Here

                info.append("Text: ").append(t.getText()).append("\n");
                info.append("Line: ").append(t.getLine()).append("\n");
                info.append("Char: ").append(t.getCharPositionInLine()).append("\n");
                info.append("Channel: ").append(t.getChannel()).append("\n");
            } else if(payload instanceof NoViableAltException) {
                NoViableAltException e = (NoViableAltException)payload;
                info.append("Description: ").append(e.grammarDecisionDescription).append("\n");
                info.append("Descision: ").append(e.decisionNumber).append("\n");
                info.append("State: ").append(e.stateNumber).append("\n");
            } else {
                if(isLeaf())
View Full Code Here

    public String getErrorMessage(RecognitionException e, String[] tokenNames) {
      String msg = null;

      if (e instanceof NoViableAltException) {
        @SuppressWarnings("unused")
        NoViableAltException nvae = (NoViableAltException) e;
        // for development, can add
        // "decision=<<"+nvae.grammarDecisionDescription+">>"
        // and "(decision="+nvae.decisionNumber+") and
        // "state "+nvae.stateNumber
View Full Code Here

      for (int i = 0; i < tokenNames.length; ++i) {
        xlateNames[i] = ParseDriver.xlate(tokenNames[i]);
      }

      if (e instanceof NoViableAltException) {
        @SuppressWarnings("unused")
        NoViableAltException nvae = (NoViableAltException) e;
        // for development, can add
        // "decision=<<"+nvae.grammarDecisionDescription+">>"
        // and "(decision="+nvae.decisionNumber+") and
        // "state "+nvae.stateNumber
View Full Code Here

    /** Consume if {@code x} is next character on the input stream.
   */
    public void match(char x) {
        if ( c != x ) {
      NoViableAltException e = new NoViableAltException("",0,0,input);
      errMgr.lexerError(input.getSourceName(), "expecting '"+x+"', found '"+str(c)+"'", templateToken, e);
    }
    consume();
    }
View Full Code Here

            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) {
            return newToken(EOF_TYPE);
View Full Code Here

            case '\\' : LINEBREAK(); return SKIP;
      case 'n'  : text = "\n"; break;
      case 't'  : text = "\t"; break;
      case ' '  : text = " "; break;
            default :
                NoViableAltException e = new NoViableAltException("",0,0,input);
                errMgr.lexerError(input.getSourceName(), "invalid escaped char: '"+str(c)+"'", templateToken, e);
        consume();
        match(delimiterStopChar);
        return SKIP;
        }
View Full Code Here

TOP

Related Classes of org.antlr.runtime.NoViableAltException

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.