Package org.antlr.runtime

Examples of org.antlr.runtime.NoViableAltException


    }

    @Override
    public Object errorNode(TokenStream input, Token start, Token stop, RecognitionException e) {
        if (e instanceof NoViableAltException) {
            NoViableAltException noAlt = (NoViableAltException) e;
            String description = noAlt.grammarDecisionDescription;
            int position = noAlt.index;
            errorMessages.add(description + ":" + position);
        }
        return super.errorNode(input, start, stop, e);
View Full Code Here


    String errorPrefix = "";

    //
    //
    if (re instanceof NoViableAltException) {
      NoViableAltException nvae = (NoViableAltException) re;
      errorPrefix = "Syntax error: ";
      m = errorPrefix + tokenText + nvae.grammarDecisionDescription;
      reportProblem(line, m, st, et);
    } else if (re instanceof MismatchedTokenException) {
View Full Code Here

    if (message != null) {
      m = message;
    }

    if (re instanceof NoViableAltException) {
      NoViableAltException ec = (NoViableAltException) re;
      if (message == null || ec.token.getText() == null) {
        m = ec.toString();
      } else {
        m = "Syntax Error:" + message + " : " + ec.token.getText();
      }
      String[] messages = { m };
      int st = converter.convert(ec.token.getLine(), ec.token.getCharPositionInLine());
      String sm = ec.token.getText();
      int et = st + ec.token.getText().length();
      if (st == -1)
        return;
      DefaultProblem defaultProblem = new DefaultProblem("", messages[0], 0, new String[] {},
              ProblemSeverities.Error, st, et, ec.token.getLine());
      if (!problems.contains(defaultProblem)) {
        reporter.reportProblem(defaultProblem);
        problems.add(defaultProblem);
        System.out.println(messages[0] + " ### line " + ec.token.getLine());
      }
    } else if (re instanceof MismatchedTokenException) {
      MismatchedTokenException ec = (MismatchedTokenException) re;
      if (message == null || ec.token.getText() == null) {
        m = ec.toString();
      } else {
        m = "mismatched input: " + message + " : " + ec.token.getText();
      }
      // if (message == null) {
      // message = "mismatched input "
View Full Code Here

                     if ((LA9_0 == EQEQ)) {
                        alt9 = 1;
                     } else if ((LA9_0 == BANGEQ)) {
                        alt9 = 2;
                     } else {
                        NoViableAltException nvae =
                           new NoViableAltException("", 9, 0, input);

                        throw nvae;
                     }
                     switch (alt9) {
                        case 1:
View Full Code Here

            if ((LA12_1 == EQ)) {
               alt12 = 1;
            } else if (((LA12_1 >= IDENTIFIER && LA12_1 <= RANGELITERAL) || LA12_1 == LPAREN || LA12_1 == LBRACKET || (LA12_1 >= BANG && LA12_1 <= TILDE) || LA12_1 == 50 || (LA12_1 >= 54 && LA12_1 <= 56))) {
               alt12 = 3;
            } else {
               NoViableAltException nvae =
                  new NoViableAltException("", 12, 1, input);

               throw nvae;
            }
         } else if ((LA12_0 == GT)) {
            int LA12_2 = input.LA(2);

            if ((LA12_2 == EQ)) {
               alt12 = 2;
            } else if (((LA12_2 >= IDENTIFIER && LA12_2 <= RANGELITERAL) || LA12_2 == LPAREN || LA12_2 == LBRACKET || (LA12_2 >= BANG && LA12_2 <= TILDE) || LA12_2 == 50 || (LA12_2 >= 54 && LA12_2 <= 56))) {
               alt12 = 4;
            } else {
               NoViableAltException nvae =
                  new NoViableAltException("", 12, 2, input);

               throw nvae;
            }
         } else {
            NoViableAltException nvae =
               new NoViableAltException("", 12, 0, input);

            throw nvae;
         }
         switch (alt12) {
            case 1:
View Full Code Here

               if ((LA14_3 == GT)) {
                  alt14 = 2;
               } else if (((LA14_3 >= IDENTIFIER && LA14_3 <= RANGELITERAL) || LA14_3 == LPAREN || LA14_3 == LBRACKET || (LA14_3 >= BANG && LA14_3 <= TILDE) || LA14_3 == 50 || (LA14_3 >= 54 && LA14_3 <= 56))) {
                  alt14 = 3;
               } else {
                  NoViableAltException nvae =
                     new NoViableAltException("", 14, 3, input);

                  throw nvae;
               }
            } else {
               NoViableAltException nvae =
                  new NoViableAltException("", 14, 2, input);

               throw nvae;
            }
         } else {
            NoViableAltException nvae =
               new NoViableAltException("", 14, 0, input);

            throw nvae;
         }
         switch (alt14) {
            case 1:
View Full Code Here

                     if ((LA15_0 == PLUS)) {
                        alt15 = 1;
                     } else if ((LA15_0 == SUB)) {
                        alt15 = 2;
                     } else {
                        NoViableAltException nvae =
                           new NoViableAltException("", 15, 0, input);

                        throw nvae;
                     }
                     switch (alt15) {
                        case 1:
View Full Code Here

                        case PERCENT: {
                           alt17 = 3;
                        }
                        break;
                        default:
                           NoViableAltException nvae =
                              new NoViableAltException("", 17, 0, input);

                           throw nvae;
                     }

                     switch (alt17) {
View Full Code Here

            case 56: {
               alt19 = 3;
            }
            break;
            default:
               NoViableAltException nvae =
                  new NoViableAltException("", 19, 0, input);

               throw nvae;
         }

         switch (alt19) {
View Full Code Here

         if ((LA25_0 == DOT)) {
            alt25 = 1;
         } else if ((LA25_0 == LBRACKET)) {
            alt25 = 2;
         } else {
            NoViableAltException nvae =
               new NoViableAltException("", 25, 0, input);

            throw nvae;
         }
         switch (alt25) {
            case 1:
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.