Java 类org.antlr.runtime.MismatchedTokenException 实例源码

项目:codebuff    文件:STLexer.java   
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+": '!"+delimiterStopChar+"' missing", templateToken, re);
            break;
        }
        consume();
    }
    consume();
    consume(); // grab !>
    return newToken(COMMENT);
}
项目:codebuff    文件:STLexer.java   
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+": '!"+delimiterStopChar+"' missing", templateToken, re);
            break;
        }
        consume();
    }
    consume();
    consume(); // grab !>
    return newToken(COMMENT);
}
项目:codebuff    文件:STLexer.java   
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+": '!"+delimiterStopChar+"' missing", templateToken, re);
            break;
        }
        consume();
    }
    consume();
    consume(); // grab !>
    return newToken(COMMENT);
}
项目:codebuff    文件:STLexer.java   
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+": '!"+delimiterStopChar+"' missing", templateToken, re);
            break;
        }
        consume();
    }
    consume();
    consume(); // grab !>
    return newToken(COMMENT);
}
项目:codebuff    文件:STLexer.java   
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+": '!"+delimiterStopChar+"' missing", templateToken, re);
            break;
        }
        consume();
    }
    consume();
    consume(); // grab !>
    return newToken(COMMENT);
}
项目:codebuff    文件:STLexer.java   
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+": '!"+delimiterStopChar+"' missing", templateToken, re);
            break;
        }
        consume();
    }
    consume();
    consume(); // grab !>
    return newToken(COMMENT);
}
项目:codebuff    文件:STLexer.java   
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+": '!"+delimiterStopChar+"' missing", templateToken, re);
            break;
        }
        consume();
    }
    consume();
    consume(); // grab !>
    return newToken(COMMENT);
}
项目:codebuff    文件:STLexer.java   
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+": '!"+delimiterStopChar+"' missing", templateToken, re);
            break;
        }
        consume();
    }
    consume();
    consume(); // grab !>
    return newToken(COMMENT);
}
项目:codebuff    文件:STLexer.java   
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 +
                              ": '!" +
                              delimiterStopChar +
                              "' missing", templateToken, re);
            break;
        }
        consume();
    }
    consume();
    consume(); // grab !>
    return newToken(COMMENT);
}
项目:codebuff    文件:STLexer.java   
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 +
                              ": '!" +
                              delimiterStopChar +
                              "' missing", templateToken, re);
            break;
        }
        consume();
    }
    consume();
    consume(); // grab !>
    return newToken(COMMENT);
}
项目:codebuff    文件:STLexer.java   
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 +
                              ": '!" +
                              delimiterStopChar +
                              "' missing" , templateToken, re);
            break;
        }
        consume();
    }
    consume();
    consume(); // grab !>
    return newToken(COMMENT);
}
项目:codebuff    文件:STLexer.java   
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 +
                              ": '!" +
                              delimiterStopChar +
                              "' missing", templateToken, re);
            break;
        }
        consume();
    }
    consume();
    consume(); // grab !>
    return newToken(COMMENT);
}
项目:codebuff    文件:STLexer.java   
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 +
                              ": '!" +
                              delimiterStopChar +
                              "' missing", templateToken, re);
            break;
        }
        consume();
    }
    consume();
    consume(); // grab !>
    return newToken(COMMENT);
}
项目:codebuff    文件:STLexer.java   
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 +
                                                     ": '!" +
                                                     delimiterStopChar +
                                                     "' missing", templateToken, re);
            break;
        }
        consume();
    }
    consume();
    consume(); // grab !>
    return newToken(COMMENT);
}
项目:codebuff    文件:STLexer.java   
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 +
                              ": '!" +
                              delimiterStopChar +
                              "' missing" , templateToken, re);
            break;
        }
        consume();
    }
    consume();
    consume(); // grab !>
    return newToken(COMMENT);
}
项目:codebuff    文件:STLexer.java   
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 +
                              ": '!" +
                              delimiterStopChar +
                              "' missing", templateToken, re);
            break;
        }
        consume();
    }
    consume();
    consume(); // grab !>
    return newToken(COMMENT);
}
项目:codebuff    文件:STLexer.java   
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+": '!"+
            delimiterStopChar+"' missing", templateToken, re);
        break;
    }
    consume();
}
      consume(); consume(); // grab !>
return newToken(COMMENT);
  }
项目:goworks    文件:ANTLRErrorProvidingParser.java   
@Override
public String toString()
{
    if (trappedException instanceof MissingTokenException)
    {
        return "<missing type: " +
               ( (MissingTokenException)trappedException ).getMissingType() +
               ">";
    } else if (trappedException instanceof UnwantedTokenException) {
        return "<extraneous: " +
               ( (UnwantedTokenException)trappedException ).getUnexpectedToken() +
               ", resync=" + getText() + ">";
    } else if (trappedException instanceof MismatchedTokenException) {
        return "<mismatched token: " + trappedException.token + ", resync=" + getText() + ">";
    } else if (trappedException instanceof NoViableAltException) {
        return "<unexpected: " + trappedException.token +
               ", resync=" + getText() + ">";
    }
    return "<error: " + getText() + ">";
}
项目:templates4j    文件:STLexer.java   
Token COMMENT() {
      match('!');
      while ( !(c=='!' && lookingAtDelimiterStop(1)) ) {
    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+": '!"+
            new String(delimiterStopChars) +"' missing", templateToken, re);
        break;
    }
    consume();
}
      consume();
      consumeDelimiterStop(null);
return newToken(COMMENT);
  }
项目:traci    文件:TraciParserTest.java   
@Test
public void testInterior() throws RecognitionException
{
    runParser("interior(1.1);");
    assertNoError();
    assertEquals(TraciParser.BLOCK, parseTree.getType());
    assertEquals(1, parseTree.getChildCount());
    Tree node = parseTree.getChild(0);
    assertEquals(TraciParser.INTERIOR, node.getType());
    assertEquals(1, node.getChildCount());
    node = node.getChild(0);
    assertEquals(TraciParser.ARGS, node.getType());
    assertEquals(1, node.getChildCount());
    node = node.getChild(0);
    assertEquals(TraciParser.FLOAT, node.getType());

    runParser("interior;");
    assertError(MismatchedTokenException.class);
}
项目:antlrworks2    文件:ANTLRErrorProvidingParser.java   
@Override
public String toString()
{
    if (trappedException instanceof MissingTokenException)
    {
        return "<missing type: " +
               ( (MissingTokenException)trappedException ).getMissingType() +
               ">";
    } else if (trappedException instanceof UnwantedTokenException) {
        return "<extraneous: " +
               ( (UnwantedTokenException)trappedException ).getUnexpectedToken() +
               ", resync=" + getText() + ">";
    } else if (trappedException instanceof MismatchedTokenException) {
        return "<mismatched token: " + trappedException.token + ", resync=" + getText() + ">";
    } else if (trappedException instanceof NoViableAltException) {
        return "<unexpected: " + trappedException.token +
               ", resync=" + getText() + ">";
    }
    return "<error: " + getText() + ">";
}
项目:Rapture    文件:MismatchedToken.java   
@Test
public void testAssert() throws RecognitionException {
    MismatchedTokenException exception = null;
    try {
        runTestFor("/error/mismatchedToken.rfx");
    } catch (org.antlr.runtime.MismatchedTokenException e) {
        exception = e;
    }
    assertNotNull(exception);
}
项目:codebuff    文件:STLexer.java   
/** <pre>
*  STRING : '"'
*           (   '\\' '"'
*           |   '\\' ~'"'
*           |   ~('\\'|'"')
*           )*
*           '"'
*         ;
* </pre>
*/
  Token mSTRING() {
    //{setText(getText().substring(1, getText().length()-1));}
      boolean sawEscape = false;
      StringBuilder buf = new StringBuilder();
      buf.append(c); consume();
      while ( c != '"' ) {
          if ( c=='\\' ) {
              sawEscape = true;
              consume();
        switch ( c ) {
            case 'n' : buf.append('\n'); break;
            case 'r' : buf.append('\r'); break;
            case 't' : buf.append('\t'); break;
                default : buf.append(c); break;
        }
        consume();
              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;
    }
      }
      buf.append(c);
      consume();
      if ( sawEscape ) return newToken(STRING, buf.toString());
      else return newToken(STRING);
  }
项目:legstar-cob2xsd    文件:RecognizerErrorHandler.java   
/**
 * Simplify error message text for end users.
 * @param e exception that occurred
 * @param msg as formatted by ANTLR
 * @return a more readable error message
 */
public static String makeUserMsg(final RecognitionException e, final String msg) {
    if (e instanceof NoViableAltException) {
        return msg.replace("no viable alternative at", "unrecognized");
    } else if (e instanceof UnwantedTokenException) {
        return msg.replace("extraneous input", "unexpected token");
    } else if (e instanceof MismatchedTokenException) {
        if (msg.contains("mismatched input '<EOF>'")) {
            return msg.replace("mismatched input '<EOF>' expecting", "reached end of file looking for");
        } else {
            return msg.replace("mismatched input", "unexpected token");
        }
    } else if (e instanceof EarlyExitException) {
        return msg.replace("required (...)+ loop did not match anything", "required tokens not found");
    } else if (e instanceof FailedPredicateException) {
        if (msg.contains("picture_string failed predicate: {Unbalanced parentheses}")) {
            return "Unbalanced parentheses in picture string";
        }
        if (msg.contains("PICTURE_PART failed predicate: {Contains invalid picture symbols}")) {
            return "Picture string contains invalid symbols";
        }
        if (msg.contains("PICTURE_PART failed predicate: {Syntax error in last picture clause}")) {
            return "Syntax error in last picture clause";
        }
        if (msg.contains("DATA_NAME failed predicate: {Syntax error in last clause}")) {
            return "Syntax error in last COBOL clause";
        }
    }
    return msg;
}
项目:legstar-core2    文件:RecognizerErrorHandler.java   
/**
 * Simplify error message text for end users.
 * @param e exception that occurred
 * @param msg as formatted by ANTLR
 * @return a more readable error message
 */
public static String makeUserMsg(final RecognitionException e, final String msg) {
    if (e instanceof NoViableAltException) {
        return msg.replace("no viable alternative at", "unrecognized");
    } else if (e instanceof UnwantedTokenException) {
        return msg.replace("extraneous input", "unexpected token");
    } else if (e instanceof MismatchedTokenException) {
        if (msg.contains("mismatched input '<EOF>'")) {
            return msg.replace("mismatched input '<EOF>' expecting", "reached end of file looking for");
        } else {
            return msg.replace("mismatched input", "unexpected token");
        }
    } else if (e instanceof EarlyExitException) {
        return msg.replace("required (...)+ loop did not match anything", "required tokens not found");
    } else if (e instanceof FailedPredicateException) {
        if (msg.contains("picture_string failed predicate: {Unbalanced parentheses}")) {
            return "Unbalanced parentheses in picture string";
        }
        if (msg.contains("PICTURE_PART failed predicate: {Contains invalid picture symbols}")) {
            return "Picture string contains invalid symbols";
        }
        if (msg.contains("PICTURE_PART failed predicate: {Syntax error in last picture clause}")) {
            return "Syntax error in last picture clause";
        }
        if (msg.contains("DATA_NAME failed predicate: {Syntax error in last clause}")) {
            return "Syntax error in last COBOL clause";
        }
    }
    return msg;
}
项目:spork-streaming    文件:TestLogicalPlanGenerator.java   
@Test(expected = MismatchedTokenException.class)
public void testNegative2() throws Exception {
    String query = "ship = load 'x';";
    try {
        ParserTestingUtils.generateLogicalPlan( query );
    } catch(Exception ex) {
        MismatchedTokenException mex = (MismatchedTokenException)ex;
        assertTrue( mex.token.getText().equals("ship") );
        throw ex;
    }
}
项目:spork-streaming    文件:TestLogicalPlanGenerator.java   
@Test(expected = MismatchedTokenException.class)
public void testNegative3() throws Exception {
    String query = "A = load 'y'; all = load 'x';";
    try {
        ParserTestingUtils.generateLogicalPlan( query );
    } catch(Exception ex) {
        MismatchedTokenException mex = (MismatchedTokenException)ex;
        assertTrue( mex.token.getText().equals("all") );
        throw ex;
    }
}
项目:framesoc.importers    文件:CtfAntlrException.java   
/**
 * Re-throw the exception but read its data
 *
 * @param e
 *            the previous recognition exception (Antlr specific)
 */
public CtfAntlrException(MismatchedTokenException e) {
    super(e);
    this.fErrorLine = e.line;
    this.fFile = "metadata"; //$NON-NLS-1$ // we're in CTF, the only thing using antlr is metadata
    parseMismatchedException(e);
}
项目:spork    文件:TestLogicalPlanGenerator.java   
@Test(expected = MismatchedTokenException.class)
public void testNegative2() throws Exception {
    String query = "ship = load 'x';";
    try {
        ParserTestingUtils.generateLogicalPlan( query );
    } catch(Exception ex) {
        MismatchedTokenException mex = (MismatchedTokenException)ex;
        assertTrue( mex.token.getText().equals("ship") );
        throw ex;
    }
}
项目:spork    文件:TestLogicalPlanGenerator.java   
@Test(expected = MismatchedTokenException.class)
public void testNegative3() throws Exception {
    String query = "A = load 'y'; all = load 'x';";
    try {
        ParserTestingUtils.generateLogicalPlan( query );
    } catch(Exception ex) {
        MismatchedTokenException mex = (MismatchedTokenException)ex;
        assertTrue( mex.token.getText().equals("all") );
        throw ex;
    }
}
项目:templates4j    文件:STLexer.java   
/** <pre>
*  STRING : '"'
*           (   '\\' '"'
*           |   '\\' ~'"'
*           |   ~('\\'|'"')
*           )*
*           '"'
*         ;
* </pre>
*/
  Token mSTRING() {
    //{setText(getText().substring(1, getText().length()-1));}
      boolean sawEscape = false;
      StringBuilder buf = new StringBuilder();
      buf.append(c); consume();
      while ( c != '"' ) {
          if ( c=='\\' ) {
              sawEscape = true;
              consume();
        switch ( c ) {
            case 'n' : buf.append('\n'); break;
            case 'r' : buf.append('\r'); break;
            case 't' : buf.append('\t'); break;
                default : buf.append(c); break;
        }
        consume();
              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;
    }
      }
      buf.append(c);
      consume();
      if ( sawEscape ) return newToken(STRING, buf.toString());
      else return newToken(STRING);
  }
项目:traci    文件:TraciParserTest.java   
@Test
public void testMismatchedToken() throws RecognitionException
{
    runParser("17+23");
    assertError(MismatchedTokenException.class);

    runParser("17+23)");
    assertError(MismatchedTokenException.class);
}
项目:traci    文件:TraciParserTest.java   
@Test
public void testVector() throws RecognitionException
{
    runParser("[.5, 2.23, .17];");
    assertNoError();
    assertEquals(TraciParser.BLOCK, parseTree.getType());
    assertEquals(1, parseTree.getChildCount());
    Tree node = parseTree.getChild(0);
    assertEquals(TraciParser.VECTOR, node.getType());
    assertEquals(2, node.getChildCount());
    assertEquals(TraciParser.LBRACKET, node.getChild(0).getType());
    node = node.getChild(1);
    assertEquals(TraciParser.ARGS, node.getType());
    assertEquals(3, node.getChildCount());

    runParser("[.5, 2.23, .17;");
    assertError(MissingTokenException.class);

    runParser("[.5, 2.23 .17];");
    assertError(MissingTokenException.class);

    runParser("[.5, 2.23];");
    assertError(MismatchedTokenException.class);

    runParser("[.5, 2.23, .17, 5];");
    assertError(MismatchedTokenException.class);
    assertError(UnwantedTokenException.class);
}
项目:traci    文件:TraciLexerTest.java   
@Test
public void testString()
{
    runLexer("\"hej\"");
    assertNoError();
    assertToken(0, TraciLexer.QSTRING, "\"hej\"", Token.DEFAULT_CHANNEL, 1, 0);
    assertToken(1, TraciLexer.EOF,     null,      Token.DEFAULT_CHANNEL, 1, 5);

    runLexer("\"hej");
    assertError(MismatchedTokenException.class, 1, 4);

    runLexer("\"foo/bar.hej\"");
    assertToken(0, TraciLexer.QSTRING, "\"foo/bar.hej\"", Token.DEFAULT_CHANNEL, 1, 0);
    assertToken(1, TraciLexer.EOF,     null,              Token.DEFAULT_CHANNEL, 1, 13);
}
项目:PonIC    文件:TestLogicalPlanGenerator.java   
@Test
public void testNegative2() {
    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." );
}
项目:PonIC    文件:TestLogicalPlanGenerator.java   
@Test
public void testNegative3() {
    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." );
}
项目:sedge    文件:TestLogicalPlanGenerator.java   
@Test
public void testNegative2() {
    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." );
}
项目:sedge    文件:TestLogicalPlanGenerator.java   
@Test
public void testNegative3() {
    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." );
}
项目:sstable-adaptor    文件:Cql_Parser.java   
@Override
protected Object recoverFromMismatchedToken(IntStream input, int ttype, BitSet follow) throws RecognitionException
{
    throw new MismatchedTokenException(ttype, input);
}
项目:sstable-adaptor    文件:CqlParser.java   
@Override
protected Object recoverFromMismatchedToken(IntStream input, int ttype, BitSet follow) throws RecognitionException
{
    throw new MismatchedTokenException(ttype, input);
}