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


Java ErrorSeverity类代码示例

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


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

示例1: getReportFormat

import org.antlr.v4.tool.ErrorSeverity; //导入依赖的package包/类
@Override
public ST getReportFormat(ErrorSeverity severity) {
    ST st = new ST("<type>(<message.id>): <message.text>");
    st.add("type", severity.getText());
    return st;
}
 
开发者ID:tunnelvisionlabs,项目名称:goworks,代码行数:7,代码来源:CompiledModelParserV4.java

示例2: apply

import org.antlr.v4.tool.ErrorSeverity; //导入依赖的package包/类
/** Called 3rd */
@Override
public void apply(@NotNull PsiFile file,
				  List<ANTLRv4ExternalAnnotator.Issue> issues,
				  @NotNull AnnotationHolder holder)
{
	for (int i = 0; i < issues.size(); i++) {
		Issue issue = issues.get(i);
		for (int j = 0; j < issue.offendingTokens.size(); j++) {
			Token t = issue.offendingTokens.get(j);
			if ( t instanceof CommonToken ) {
				CommonToken ct = (CommonToken)t;
				int startIndex = ct.getStartIndex();
				int stopIndex = ct.getStopIndex();
				TextRange range = new TextRange(startIndex, stopIndex + 1);
				ErrorSeverity severity = ErrorSeverity.INFO;
				if ( issue.msg.getErrorType()!=null ) {
					severity = issue.msg.getErrorType().severity;
				}
				switch ( severity ) {
				case ERROR:
				case ERROR_ONE_OFF:
				case FATAL:
					holder.createErrorAnnotation(range, issue.annotation);
					break;

				case WARNING:
					holder.createWarningAnnotation(range, issue.annotation);
					break;

				case WARNING_ONE_OFF:
				case INFO:
					holder.createWeakWarningAnnotation(range, issue.annotation);

				default:
					break;
				}
			}
		}
	}
	super.apply(file, issues, holder);
}
 
开发者ID:antlr,项目名称:intellij-plugin-v4,代码行数:43,代码来源:ANTLRv4ExternalAnnotator.java


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