/// <summary> /// Find GUIDs and string-substitution tokens within a string and return tagged spans for all /// </summary> /// <param name="tokenType">type of the original token for the span</param> /// <param name="startPos">first character index</param> /// <param name="endPos">last character index</param> /// <param name="text">entire virtual line</param> /// <returns>unordered enumeration of tokens</returns> private IEnumerable <PkgDefTokenSpan> GetStringSpans(PkgDefLanguageTokens tokenType, int startPos, int endPos, ref string text) { List <PkgDefTokenSpan> tokens = new List <PkgDefTokenSpan>(); if (endPos > startPos) { string textToScan = text.Substring(startPos, endPos - startPos + 1); foreach (PkgDefTokenSpan span in GetGuidTags(ref textToScan)) { tokens.Add(span.OffsetFrom(startPos)); } foreach (PkgDefTokenSpan span in GetTokenTags(ref textToScan)) { tokens.Add(span.OffsetFrom(startPos)); } tokens.Add(new PkgDefTokenSpan(GetSpanOfSubstring(startPos, endPos), tokenType)); } return(tokens); }
public PkgDefTokenSpan(Span span, PkgDefLanguageTokens type, string errorText = "") { _tokenType = type; _span = span; _errorText = errorText; }
public PkgDefTokenSpan(Span span, string errorText = "") { _tokenType = PkgDefLanguageTokens.Error; _span = span; _errorText = errorText; }
public PkgDefTokenSpan(Span span, PkgDefLanguageTokens type) { _tokenType = type; _span = span; _errorText = ""; }
public PkgDefTokenTag(PkgDefLanguageTokens type) { this.type = type; }