示例#1
0
 internal void HandleError(Node offendingNode, Error error, params string[] messageParameters){
   if (offendingNode == null || (offendingNode is Literal && offendingNode.SourceContext.Document == null)) return;
   PragmaInfo pragmaInfo = null;
   PragmaInfo matchingPragmaInfo = null;
   if (this.PragmaWarnInformation != null) {
     pragmaInfo = (PragmaInfo)this.PragmaWarnInformation[(int)error];
     if (pragmaInfo != null) {
       int lineNum = offendingNode.SourceContext.StartLine;          
       while (pragmaInfo != null) {
         if (pragmaInfo.LineNum < lineNum) {
           matchingPragmaInfo = pragmaInfo;
           break;
         }
         pragmaInfo = pragmaInfo.Next;
       }
       if (matchingPragmaInfo != null && matchingPragmaInfo.Disable)
         return;
     }
   }
   SpecSharpErrorNode enode = new SpecSharpErrorNode(error, messageParameters);
   if (pragmaInfo != null && !pragmaInfo.Disable && pragmaInfo == matchingPragmaInfo)
     enode.DoNotSuppress = true;
   enode.SourceContext = offendingNode.SourceContext;
   this.Errors.Add(enode);
 }
示例#2
0
 private void HandleError(SourceContext ctx, Error error, params string[] messageParameters){
   if (ctx.Document == null) return;
   ErrorNode enode = new SpecSharpErrorNode(error, messageParameters);
   enode.SourceContext = ctx;
   if (this.errors == null) return;
   this.errors.Add(enode);
 }
示例#3
0
 public override ErrorNode CreateErrorNode(Cci.Error error, Method method){
   Error e = ErrorHandler.MapError(error);
   if (e == Error.None) return null;
   if (e == Error.UnexpectedToken) return base.CreateErrorNode(error, method);
   ErrorNode result = new SpecSharpErrorNode(e, (new ErrorHandler(new ErrorNodeList())).GetMethodSignature(method));
   result.SourceContext = method.Name.SourceContext;
   return result;
 }
示例#4
0
 private void HandleError(Error error, params string[] messageParameters){
   ErrorNode enode = new SpecSharpErrorNode(error, messageParameters);
   enode.SourceContext = this.scanner.CurrentSourceContext;
   if (error == Error.ExpectedSemicolon && this.scanner.TokenIsFirstAfterLineBreak){
     int i = this.scanner.eolPos;
     if (i > 1)
       enode.SourceContext.StartPos = i-2; //Try to have a place for the cursor to hover
     else
       enode.SourceContext.StartPos = 0;
     enode.SourceContext.EndPos = i;
   }
   if (this.errors == null) return;
   this.errors.Add(enode);
 }
示例#5
0
 private void HandleError(Error error, params string[] messageParameters){
   if (this.errors == null) return;
   if (this.endPos <= this.lastReportedErrorPos) return;
   this.lastReportedErrorPos = this.endPos;
   ErrorNode enode = new SpecSharpErrorNode(error, messageParameters);
   enode.SourceContext = new SourceContext(this.document, (error == Error.BadHexDigit ? this.endPos-1 : this.startPos), this.endPos);
   this.errors.Add(enode);
 }