本文整理匯總了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);
}