本文整理汇总了C#中ErrorHandler.SortedErrorList方法的典型用法代码示例。如果您正苦于以下问题:C# ErrorHandler.SortedErrorList方法的具体用法?C# ErrorHandler.SortedErrorList怎么用?C# ErrorHandler.SortedErrorList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ErrorHandler
的用法示例。
在下文中一共展示了ErrorHandler.SortedErrorList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseSource
public override Microsoft.VisualStudio.Package.AuthoringScope ParseSource(ParseRequest req)
{
Babel.Source source = (Babel.Source)this.GetSource(req.FileName);
bool yyparseResult = false;
// req.DirtySpan seems to be set even though no changes have occurred
// source.IsDirty also behaves strangely
// might be possible to use source.ChangeCount to sync instead
if (req.DirtySpan.iStartIndex != req.DirtySpan.iEndIndex
|| req.DirtySpan.iStartLine != req.DirtySpan.iEndLine) {
ErrorHandler handler = new ErrorHandler();
Scanner scanner = new Scanner(); // string interface
Parser parser = new Parser(); // use noarg constructor
parser.scanner = scanner;
scanner.Handler = handler;
parser.SetHandler(handler);
scanner.SetSource(req.Text, 0);
parser.MBWInit(req);
yyparseResult = parser.Parse();
// store the parse results
// source.ParseResult = aast;
source.ParseResult = null;
source.Braces = parser.Braces;
// for the time being, just pull errors back from the error handler
if (handler.ErrNum > 0) {
foreach (Babel.Parser.Error error in handler.SortedErrorList()) {
TextSpan span = new TextSpan();
span.iStartLine = span.iEndLine = error.line - 1;
span.iStartIndex = error.column;
span.iEndIndex = error.column + error.length;
req.Sink.AddError(req.FileName, error.message, span, Severity.Error);
}
}
}
switch (req.Reason) {
case ParseReason.Check:
case ParseReason.HighlightBraces:
case ParseReason.MatchBraces:
case ParseReason.MemberSelectAndHighlightBraces:
// send matches to sink
// this should (probably?) be filtered on req.Line / col
if (source.Braces != null) {
foreach (TextSpan[] brace in source.Braces) {
if (brace.Length == 2)
req.Sink.MatchPair(brace[0], brace[1], 1);
else if (brace.Length >= 3)
req.Sink.MatchTriple(brace[0], brace[1], brace[2], 1);
}
}
break;
default:
break;
}
return new AuthoringScope(req.Text);
}