当前位置: 首页>>代码示例>>Java>>正文


Java ANTLRErrorStrategy类代码示例

本文整理汇总了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;未经允许,请勿转载。