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