Esempio n. 1
0
        public readonly TextSpan TextSpan; //opt

        #endregion Fields

        #region Constructors

        public Diagnostic(DiagnosticSeverity severity, int code, string message, TextSpan textSpan)
        {
            Severity = severity;
            Code = code;
            Message = message;
            TextSpan = textSpan;
        }
Esempio n. 2
0
 public void AddDiag(DiagnosticSeverity severity, int code, string message, TextSpan textSpan)
 {
     DiagnosticList.Add(new Diagnostic(severity, code, message, textSpan));
 }
Esempio n. 3
0
 private void ErrorAndThrow(string errMsg, TextSpan textSpan)
 {
     _context.AddDiag(DiagnosticSeverity.Error, Extensions.ParsingErrorCode, errMsg, textSpan);
     throw ParsingException.Instance;
 }
Esempio n. 4
0
 private string TryGetPpIdentifier(out TextSpan ts)
 {
     var ch = GetChar();
     while (SyntaxFacts.IsWhitespace(ch))
     {
         ConsumeChar();
         ch = GetChar();
     }
     if (SyntaxFacts.IsIdentifierStartCharacter(ch))
     {
         var sb = GetStringBuilder();
         sb.Append(ch);
         MarkTokenStart();
         ConsumeChar();
         while (true)
         {
             ch = GetChar();
             if (SyntaxFacts.IsIdentifierPartCharacter(ch))
             {
                 sb.Append(ch);
                 ConsumeChar();
             }
             else
             {
                 break;
             }
         }
         ts = CreateFullTextSpan();
         return sb.ToString();
     }
     ts = default(TextSpan);
     return null;
 }
Esempio n. 5
0
 private string GetPpIdentifier(out TextSpan ts)
 {
     var s = TryGetPpIdentifier(out ts);
     if (s == null)
     {
         ErrorAndThrow("Identifier expected.");
     }
     return s;
 }
Esempio n. 6
0
 public TextSpan MergeWith(TextSpan follower)
 {
     return new TextSpan(FilePath, StartIndex, Length + follower.Length, StartPosition, follower.EndPosition);
 }