• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java FailedPredicateException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.antlr.runtime.FailedPredicateException的典型用法代码示例。如果您正苦于以下问题:Java FailedPredicateException类的具体用法?Java FailedPredicateException怎么用?Java FailedPredicateException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



FailedPredicateException类属于org.antlr.runtime包,在下文中一共展示了FailedPredicateException类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: nextToken

import org.antlr.runtime.FailedPredicateException; //导入依赖的package包/类
@Override
public Token nextToken() {
	while (true) {
		this.state.token = null;
		this.state.channel = Token.DEFAULT_CHANNEL;
		this.state.tokenStartCharIndex = input.index();
		this.state.tokenStartCharPositionInLine = input.getCharPositionInLine();
		this.state.tokenStartLine = input.getLine();
		this.state.text = null;
		if (input.LA(1) == CharStream.EOF) {
			return Token.EOF_TOKEN;
		}
		try {
			mTokens();
			if (this.state.token == null) {
				emit();
			}
			else if (this.state.token == Token.SKIP_TOKEN) {
				continue;
			}
			return this.state.token;
		}
		catch (RecognitionException re) {
			reportError(re);
			if (re instanceof NoViableAltException ||
				re instanceof FailedPredicateException) {
				recover(re);
			}
			// create token that holds mismatched char
			Token t = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.HIDDEN_CHANNEL,
					this.state.tokenStartCharIndex, getCharIndex() - 1);
			t.setLine(this.state.tokenStartLine);
			t.setCharPositionInLine(this.state.tokenStartCharPositionInLine);
			tokenErrorMap.put(t, getErrorMessage(re, this.getTokenNames()));
			emit(t);
			return this.state.token;
		}
	}
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:40,代码来源:Lexer.java


示例2: recover

import org.antlr.runtime.FailedPredicateException; //导入依赖的package包/类
@Override
public void recover(IntStream stream, RecognitionException ex) {
	if (recoveryListener != null)
		recoveryListener.beginErrorRecovery();
	removeUnexpectedElements();
	if (ex instanceof FailedPredicateException && ex.token.getType() == Token.EOF) {
		failedPredicateAtEOF = true;
	}
	super.recover(stream, ex);
	if (recoveryListener != null)
		recoveryListener.endErrorRecovery();
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:13,代码来源:BaseInternalContentAssistParser.java


示例3: makeUserMsg

import org.antlr.runtime.FailedPredicateException; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:legsem,项目名称:legstar-cob2xsd,代码行数:36,代码来源:RecognizerErrorHandler.java


示例4: streetAddressStart

import org.antlr.runtime.FailedPredicateException; //导入依赖的package包/类
public final void streetAddressStart() throws RecognitionException {
    try {
        // /Users/jeffrey/Documents/workspace/matchmaker/src/ca/sqlpower/matchmaker/address/parse/Address.g:187:2: ({...}? streetAddress )
        // /Users/jeffrey/Documents/workspace/matchmaker/src/ca/sqlpower/matchmaker/address/parse/Address.g:187:4: {...}? streetAddress
        {
        if ( !((setStartsUrbanNotRural(true))) ) {
            throw new FailedPredicateException(input, "streetAddressStart", "setStartsUrbanNotRural(true)");
        }
        pushFollow(FOLLOW_streetAddress_in_streetAddressStart132);
        streetAddress();

        state._fsp--;


        							  address.setType(PostalCode.RecordType.STREET);
        							  if (address.isUrbanBeforeRural() != null) {
        							    address.setType(PostalCode.RecordType.STREET_AND_ROUTE);
        							  }
        							

        }

    }
    catch (RecognitionException re) {
        reportError(re);
        recover(input,re);
    }
    finally {
    }
    return ;
}
 
开发者ID:SQLPower,项目名称:power-matchmaker,代码行数:32,代码来源:AddressParser.java


示例5: ruralRouteAddress

import org.antlr.runtime.FailedPredicateException; //导入依赖的package包/类
public final void ruralRouteAddress() throws RecognitionException {
    try {
        // /Users/jeffrey/Documents/workspace/matchmaker/src/ca/sqlpower/matchmaker/address/parse/Address.g:308:2: ({...}? ruralRoute )
        // /Users/jeffrey/Documents/workspace/matchmaker/src/ca/sqlpower/matchmaker/address/parse/Address.g:308:4: {...}? ruralRoute
        {
        if ( !((setStartsUrbanNotRural(false))) ) {
            throw new FailedPredicateException(input, "ruralRouteAddress", "setStartsUrbanNotRural(false)");
        }
        pushFollow(FOLLOW_ruralRoute_in_ruralRouteAddress474);
        ruralRoute();

        state._fsp--;

        address.setType(PostalCode.RecordType.ROUTE);
        							  if (address.isUrbanBeforeRural() != null) {
        							    address.setType(PostalCode.RecordType.STREET_AND_ROUTE);
        							  }
        							

        }

    }
    catch (RecognitionException re) {
        reportError(re);
        recover(input,re);
    }
    finally {
    }
    return ;
}
 
开发者ID:SQLPower,项目名称:power-matchmaker,代码行数:31,代码来源:AddressParser.java


示例6: UnorderedGroupErrorContext

import org.antlr.runtime.FailedPredicateException; //导入依赖的package包/类
protected UnorderedGroupErrorContext(FailedPredicateException exception) {
	super(exception);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:4,代码来源:AbstractInternalAntlrParser.java


示例7: getRecognitionException

import org.antlr.runtime.FailedPredicateException; //导入依赖的package包/类
@Override
public FailedPredicateException getRecognitionException() {
	return (FailedPredicateException) super.getRecognitionException();
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:5,代码来源:AbstractInternalAntlrParser.java


示例8: createErrorContext

import org.antlr.runtime.FailedPredicateException; //导入依赖的package包/类
protected IParserErrorContext createErrorContext(RecognitionException e) {
	if (e instanceof FailedPredicateException)
		return new UnorderedGroupErrorContext((FailedPredicateException) e);
	return new ParserErrorContext(e);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:6,代码来源:AbstractInternalAntlrParser.java


示例9: getRecognitionException

import org.antlr.runtime.FailedPredicateException; //导入依赖的package包/类
/**
 * Returns the failed predicate exception caused by a specific unordered group.
 * @return the failed predicate exception caused by a specific unordered group. Never <code>null</code>.
 */
@Override
FailedPredicateException getRecognitionException();
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:7,代码来源:ISyntaxErrorMessageProvider.java



注:本文中的org.antlr.runtime.FailedPredicateException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java UpdateCallback类代码示例发布时间:2022-05-23
下一篇:
Java PlanarImgFactory类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap