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; }
public void AddDiag(DiagnosticSeverity severity, int code, string message, TextSpan textSpan) { DiagnosticList.Add(new Diagnostic(severity, code, message, textSpan)); }
private void ErrorAndThrow(string errMsg, TextSpan textSpan) { _context.AddDiag(DiagnosticSeverity.Error, Extensions.ParsingErrorCode, errMsg, textSpan); throw ParsingException.Instance; }
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; }
private string GetPpIdentifier(out TextSpan ts) { var s = TryGetPpIdentifier(out ts); if (s == null) { ErrorAndThrow("Identifier expected."); } return s; }
public TextSpan MergeWith(TextSpan follower) { return new TextSpan(FilePath, StartIndex, Length + follower.Length, StartPosition, follower.EndPosition); }