Package org.antlr.runtime

Examples of org.antlr.runtime.MismatchedTokenException


        if ( text != null ) {
            e = new DroolsMismatchedTokenException( ttype,
                                                    text,
                                                    input );
        } else {
            e = new MismatchedTokenException( ttype,
                                              input );
        }
        throw e;
    }
View Full Code Here


      //Show the Default exact Error Messages (not translatable)
      return processor.getErrorMessage( e, tokens);
    }
    //AdvancedErrorMessages are not actived --> show Custom Error-Messages
        if ( e instanceof org.antlr.runtime.MismatchedTokenException ) {
          MismatchedTokenException mte = (MismatchedTokenException) e;
          String msg = "";
          //If Token = EOF -->Special Error Message
          if(mte.c == Token.EOF){
            msg = Messages.getString("Metrics.Calculate.Error.Antlr.EOF_Error_Part1");
            try{
View Full Code Here

      String query = "ship = load 'x';";
      try {
            ParserTestingUtils.generateLogicalPlan( query );
        } catch(Exception ex) {
            Assert.assertTrue( ex instanceof MismatchedTokenException );
            MismatchedTokenException mex = (MismatchedTokenException)ex;
            Assert.assertTrue( mex.token.getText().equals("ship") );
            return;
        }
        Assert.fail( "Query is supposed to be failing." );
    }
View Full Code Here

      String query = "A = load 'y'; all = load 'x';";
      try {
            ParserTestingUtils.generateLogicalPlan( query );
        } catch(Exception ex) {
            Assert.assertTrue( ex instanceof MismatchedTokenException );
            MismatchedTokenException mex = (MismatchedTokenException)ex;
            Assert.assertTrue( mex.token.getText().equals("all") );
            return;
        }
        Assert.fail( "Query is supposed to be failing." );
    }
View Full Code Here

                              null,
                              DroolsEditorType.IDENTIFIER );
            if ( state.failed ) return null;
            return StringUtils.unescapeJava( safeStripStringDelimiters( id.getText() ) );
        } else {
            throw new MismatchedTokenException( DRLLexer.ID,
                                                input );
        }
    }
View Full Code Here

        if ( text != null ) {
            e = new DroolsMismatchedTokenException( ttype,
                                                    text,
                                                    input );
        } else {
            e = new MismatchedTokenException( ttype,
                                              input );
        }
        throw e;
    }
View Full Code Here

         CommonTokenStream stream = new CommonTokenStream(lexer);
         XPathParser parser = new XPathParser(stream) {

            protected void mismatch(IntStream input, int ttype, BitSet follow)
                     throws RecognitionException {
               throw new MismatchedTokenException(ttype, input);
            }

         };
         parser.expr();
         return parser.root;
View Full Code Here

                              null,
                              DroolsEditorType.IDENTIFIER );
            if ( state.failed ) return null;
            return StringUtils.unescapeJava( safeStripStringDelimiters( id.getText() ) );
        } else {
            throw new MismatchedTokenException( DRL6Lexer.ID,
                                                input );
        }
    }
View Full Code Here

        if ( text != null ) {
            e = new DroolsMismatchedTokenException( ttype,
                                                    text,
                                                    input );
        } else {
            e = new MismatchedTokenException( ttype,
                                              input );
        }
        throw e;
    }
View Full Code Here

   */
  private List<String> createErrorMessage(RecognitionException e) {
    List<String> codeAndMessage = new ArrayList<String>(2);
    String message = "";
    if (e instanceof MismatchedTokenException) {
      MismatchedTokenException mte = (MismatchedTokenException) e;
      if (tokenNames != null && mte.expecting >= 0 && mte.expecting < tokenNames.length) {
        message = String
            .format(
                DroolsParserExceptionFactory.MISMATCHED_TOKEN_MESSAGE_COMPLETE,
                e.line, e.charPositionInLine,
View Full Code Here

TOP

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