當前位置: 首頁>>代碼示例>>Java>>正文


Java RecognitionException類代碼示例

本文整理匯總了Java中org.antlr.runtime.RecognitionException的典型用法代碼示例。如果您正苦於以下問題:Java RecognitionException類的具體用法?Java RecognitionException怎麽用?Java RecognitionException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


RecognitionException類屬於org.antlr.runtime包,在下文中一共展示了RecognitionException類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: parseAnyUnhandled

import org.antlr.runtime.RecognitionException; //導入依賴的package包/類
/**
 * Just call a parser method in {@link CqlParser} - does not do any error handling.
 */
public static <R> R parseAnyUnhandled(CQLParserFunction<R> parserFunction, String input) throws RecognitionException
{
    // Lexer and parser
    ErrorCollector errorCollector = new ErrorCollector(input);
    CharStream stream = new ANTLRStringStream(input);
    CqlLexer lexer = new CqlLexer(stream);
    lexer.addErrorListener(errorCollector);

    TokenStream tokenStream = new CommonTokenStream(lexer);
    CqlParser parser = new CqlParser(tokenStream);
    parser.addErrorListener(errorCollector);

    // Parse the query string to a statement instance
    R r = parserFunction.parse(parser);

    // The errorCollector has queue up any errors that the lexer and parser may have encountered
    // along the way, if necessary, we turn the last error into exceptions here.
    errorCollector.throwFirstSyntaxError();

    return r;
}
 
開發者ID:Netflix,項目名稱:sstable-adaptor,代碼行數:25,代碼來源:CQLFragmentParser.java

示例2: syntaxError

import org.antlr.runtime.RecognitionException; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public void syntaxError(BaseRecognizer recognizer, String[] tokenNames, RecognitionException e)
{
    String hdr = recognizer.getErrorHeader(e);
    String msg = recognizer.getErrorMessage(e, tokenNames);

    StringBuilder builder = new StringBuilder().append(hdr)
            .append(' ')
            .append(msg);

    if (recognizer instanceof Parser)
        appendQuerySnippet((Parser) recognizer, builder);

    errorMsgs.add(builder.toString());
}
 
開發者ID:Netflix,項目名稱:sstable-adaptor,代碼行數:19,代碼來源:ErrorCollector.java

示例3: mT__183

import org.antlr.runtime.RecognitionException; //導入依賴的package包/類
public final void mT__183() throws RecognitionException {
	try {
		int _type = T__183;
		int _channel = DEFAULT_TOKEN_CHANNEL;
		// Cql__.g:50:8: ( '(' )
		// Cql__.g:50:10: '('
		{
		match('('); 
		}

		state.type = _type;
		state.channel = _channel;
	}
	finally {
		// do for sure before leaving
	}
}
 
開發者ID:Netflix,項目名稱:sstable-adaptor,代碼行數:18,代碼來源:CqlLexer.java

示例4: mT__184

import org.antlr.runtime.RecognitionException; //導入依賴的package包/類
public final void mT__184() throws RecognitionException {
	try {
		int _type = T__184;
		int _channel = DEFAULT_TOKEN_CHANNEL;
		// Cql__.g:51:8: ( ')' )
		// Cql__.g:51:10: ')'
		{
		match(')'); 
		}

		state.type = _type;
		state.channel = _channel;
	}
	finally {
		// do for sure before leaving
	}
}
 
開發者ID:Netflix,項目名稱:sstable-adaptor,代碼行數:18,代碼來源:CqlLexer.java

示例5: mT__185

import org.antlr.runtime.RecognitionException; //導入依賴的package包/類
public final void mT__185() throws RecognitionException {
	try {
		int _type = T__185;
		int _channel = DEFAULT_TOKEN_CHANNEL;
		// Cql__.g:52:8: ( '+' )
		// Cql__.g:52:10: '+'
		{
		match('+'); 
		}

		state.type = _type;
		state.channel = _channel;
	}
	finally {
		// do for sure before leaving
	}
}
 
開發者ID:Netflix,項目名稱:sstable-adaptor,代碼行數:18,代碼來源:CqlLexer.java

示例6: mT__187

import org.antlr.runtime.RecognitionException; //導入依賴的package包/類
public final void mT__187() throws RecognitionException {
	try {
		int _type = T__187;
		int _channel = DEFAULT_TOKEN_CHANNEL;
		// Cql__.g:54:8: ( ',' )
		// Cql__.g:54:10: ','
		{
		match(','); 
		}

		state.type = _type;
		state.channel = _channel;
	}
	finally {
		// do for sure before leaving
	}
}
 
開發者ID:Netflix,項目名稱:sstable-adaptor,代碼行數:18,代碼來源:CqlLexer.java

示例7: mT__188

import org.antlr.runtime.RecognitionException; //導入依賴的package包/類
public final void mT__188() throws RecognitionException {
	try {
		int _type = T__188;
		int _channel = DEFAULT_TOKEN_CHANNEL;
		// Cql__.g:55:8: ( '-' )
		// Cql__.g:55:10: '-'
		{
		match('-'); 
		}

		state.type = _type;
		state.channel = _channel;
	}
	finally {
		// do for sure before leaving
	}
}
 
開發者ID:Netflix,項目名稱:sstable-adaptor,代碼行數:18,代碼來源:CqlLexer.java

示例8: mT__190

import org.antlr.runtime.RecognitionException; //導入依賴的package包/類
public final void mT__190() throws RecognitionException {
	try {
		int _type = T__190;
		int _channel = DEFAULT_TOKEN_CHANNEL;
		// Cql__.g:57:8: ( '.' )
		// Cql__.g:57:10: '.'
		{
		match('.'); 
		}

		state.type = _type;
		state.channel = _channel;
	}
	finally {
		// do for sure before leaving
	}
}
 
開發者ID:Netflix,項目名稱:sstable-adaptor,代碼行數:18,代碼來源:CqlLexer.java

示例9: mT__191

import org.antlr.runtime.RecognitionException; //導入依賴的package包/類
public final void mT__191() throws RecognitionException {
	try {
		int _type = T__191;
		int _channel = DEFAULT_TOKEN_CHANNEL;
		// Cql__.g:58:8: ( ':' )
		// Cql__.g:58:10: ':'
		{
		match(':'); 
		}

		state.type = _type;
		state.channel = _channel;
	}
	finally {
		// do for sure before leaving
	}
}
 
開發者ID:Netflix,項目名稱:sstable-adaptor,代碼行數:18,代碼來源:CqlLexer.java

示例10: mT__196

import org.antlr.runtime.RecognitionException; //導入依賴的package包/類
public final void mT__196() throws RecognitionException {
	try {
		int _type = T__196;
		int _channel = DEFAULT_TOKEN_CHANNEL;
		// Cql__.g:63:8: ( '>' )
		// Cql__.g:63:10: '>'
		{
		match('>'); 
		}

		state.type = _type;
		state.channel = _channel;
	}
	finally {
		// do for sure before leaving
	}
}
 
開發者ID:Netflix,項目名稱:sstable-adaptor,代碼行數:18,代碼來源:CqlLexer.java

示例11: mT__197

import org.antlr.runtime.RecognitionException; //導入依賴的package包/類
public final void mT__197() throws RecognitionException {
	try {
		int _type = T__197;
		int _channel = DEFAULT_TOKEN_CHANNEL;
		// Cql__.g:64:8: ( '>=' )
		// Cql__.g:64:10: '>='
		{
		match(">="); 

		}

		state.type = _type;
		state.channel = _channel;
	}
	finally {
		// do for sure before leaving
	}
}
 
開發者ID:Netflix,項目名稱:sstable-adaptor,代碼行數:19,代碼來源:CqlLexer.java

示例12: mT__198

import org.antlr.runtime.RecognitionException; //導入依賴的package包/類
public final void mT__198() throws RecognitionException {
	try {
		int _type = T__198;
		int _channel = DEFAULT_TOKEN_CHANNEL;
		// Cql__.g:65:8: ( '[' )
		// Cql__.g:65:10: '['
		{
		match('['); 
		}

		state.type = _type;
		state.channel = _channel;
	}
	finally {
		// do for sure before leaving
	}
}
 
開發者ID:Netflix,項目名稱:sstable-adaptor,代碼行數:18,代碼來源:CqlLexer.java

示例13: mT__200

import org.antlr.runtime.RecognitionException; //導入依賴的package包/類
public final void mT__200() throws RecognitionException {
	try {
		int _type = T__200;
		int _channel = DEFAULT_TOKEN_CHANNEL;
		// Cql__.g:67:8: ( ']' )
		// Cql__.g:67:10: ']'
		{
		match(']'); 
		}

		state.type = _type;
		state.channel = _channel;
	}
	finally {
		// do for sure before leaving
	}
}
 
開發者ID:Netflix,項目名稱:sstable-adaptor,代碼行數:18,代碼來源:CqlLexer.java

示例14: mT__201

import org.antlr.runtime.RecognitionException; //導入依賴的package包/類
public final void mT__201() throws RecognitionException {
	try {
		int _type = T__201;
		int _channel = DEFAULT_TOKEN_CHANNEL;
		// Cql__.g:68:8: ( 'expr(' )
		// Cql__.g:68:10: 'expr('
		{
		match("expr("); 

		}

		state.type = _type;
		state.channel = _channel;
	}
	finally {
		// do for sure before leaving
	}
}
 
開發者ID:Netflix,項目名稱:sstable-adaptor,代碼行數:19,代碼來源:CqlLexer.java

示例15: keyspaceName

import org.antlr.runtime.RecognitionException; //導入依賴的package包/類
public final String keyspaceName() throws RecognitionException {
	String id = null;


	CFName name = new CFName();
	try {
		// Parser.g:1205:5: ( ksName[name] )
		// Parser.g:1205:7: ksName[name]
		{
			pushFollow(FOLLOW_ksName_in_keyspaceName8043);
			ksName(name);
			state._fsp--;

			id = name.getKeyspace();
		}

	}
	catch (RecognitionException re) {
		reportError(re);
		recover(input,re);
	}
	finally {
		// do for sure before leaving
	}
	return id;
}
 
開發者ID:Netflix,項目名稱:sstable-adaptor,代碼行數:27,代碼來源:Cql_Parser.java


注:本文中的org.antlr.runtime.RecognitionException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。