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

Java ANTLRErrorStrategy类代码示例

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

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



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

示例1: configure

import org.antlr.v4.runtime.ANTLRErrorStrategy; //导入依赖的package包/类
@Override
protected void configure() {
    bind(Importer.class).to(ImporterImpl.class);
    bind(FileDescriptorLoader.class).to(FileDescriptorLoaderImpl.class);
    bind(ANTLRErrorListener.class).to(ParseErrorLogger.class);
    bind(ANTLRErrorStrategy.class).to(BailErrorStrategy.class);
    bind(ProtoContext.class)
            .annotatedWith(Names.named(DESCRIPTOR_PROTO))
            .toProvider(DefaultDescriptorProtoProvider.class);

    Multibinder<ProtoContextPostProcessor> postProcessors = Multibinder
            .newSetBinder(binder(), ProtoContextPostProcessor.class);
    postProcessors.addBinding().to(ImportsPostProcessor.class);
    postProcessors.addBinding().to(TypeRegistratorPostProcessor.class);
    postProcessors.addBinding().to(TypeResolverPostProcessor.class);
    postProcessors.addBinding().to(ExtensionRegistratorPostProcessor.class);
    postProcessors.addBinding().to(OptionsPostProcessor.class);
    postProcessors.addBinding().to(UserTypeValidationPostProcessor.class);

    install(new FactoryModuleBuilder()
            .implement(FileReader.class, MultiPathFileReader.class)
            .build(FileReaderFactory.class));
}
 
开发者ID:protostuff,项目名称:protostuff-compiler,代码行数:24,代码来源:ParserModule.java


示例2: syntaxError

import org.antlr.v4.runtime.ANTLRErrorStrategy; //导入依赖的package包/类
public void syntaxError(Recognizer<?, ?> aRecognizer,
		Object aOffendingSymbol, int aLine, int aCharIndex,
		String aMessage, RecognitionException aException) {
	ANTLRErrorStrategy errorHandler = myParser.getErrorHandler();

	if (LOGGER.isWarnEnabled()) {
		LOGGER.warn(aMessage + " [" + aLine + ":" + aCharIndex + "]");
	}

	/*
	 * Setting the lexer exception in the parser since I don't see a
	 * getNumberOfSyntaxErrors() method in the lexer (like in antlr3) and
	 * the lexer's errors aren't being reported by parser's method
	 * 
	 * I may just be missing the correct way this should be handled(?)
	 */
	if (aException instanceof LexerNoViableAltException) {
		NoViableAltException exception = new NoViableAltException(myParser);
		errorHandler.reportError(myParser, exception);
	}
	else {
		errorHandler.reportError(myParser, aException);
	}
}
 
开发者ID:ksclarke,项目名称:freelib-edtf,代码行数:25,代码来源:ParserErrorListener.java


示例3: Builder

import org.antlr.v4.runtime.ANTLRErrorStrategy; //导入依赖的package包/类
Builder(final ANTLRErrorStrategy errorStrategy, final IBaseProtoErrorListener errorListener,
    final FileDescriptors.Builder fileBuilder) {
  dirs = new LinkedHashMap<URI, Set<URI>>();
  sources = new LinkedHashMap<URI, String>();
  sourceProtos = new ArrayList<FileDescriptorProto>();
  this.errorStrategy = Objects.requireNonNull(errorStrategy);
  this.errorListener = Objects.requireNonNull(errorListener);
  this.fileBuilder = Objects.requireNonNull(fileBuilder);
}
 
开发者ID:protobufel,项目名称:protobuf-el,代码行数:10,代码来源:ProtoFiles.java


示例4: ErrorStrategy

import org.antlr.v4.runtime.ANTLRErrorStrategy; //导入依赖的package包/类
ErrorStrategy(ANTLRErrorStrategy delegate) {
    this.delegate = delegate;
}
 
开发者ID:Abnaxos,项目名称:contracts,代码行数:4,代码来源:AstBuilder.java


示例5: setErrorStrategy

import org.antlr.v4.runtime.ANTLRErrorStrategy; //导入依赖的package包/类
/**
 * Set the error handler strategy for ANTLR. If not set, {@link DefaultErrorStrategy} is used.
 *
 * @param errorStrategy ANTLR error strategy
 * @return builder
 */
public Builder setErrorStrategy(ANTLRErrorStrategy errorStrategy) {
  this.errorStrategy = errorStrategy;
  return this;
}
 
开发者ID:s1ck,项目名称:gdl,代码行数:11,代码来源:GDLHandler.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java S18PacketEntityTeleport类代码示例发布时间:2022-05-23
下一篇:
Java IdentityKeyPair类代码示例发布时间: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