本文整理汇总了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;
}
示例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());
}
示例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
}
}
示例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
}
}
示例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
}
}
示例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
}
}
示例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
}
}
示例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
}
}
示例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
}
}
示例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
}
}
示例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
}
}
示例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
}
}
示例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
}
}
示例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
}
}
示例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;
}