當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。