Beispiel #1
0
 private void Find(StringBuilder word, List <ITagSpan <IClassificationTag> > tags, NfxTokenTypes type,
                   int currenPosition, params string[] additionalTokens)
 {
     if (Configurator.GetGroupKeywords(type.ToString()).Any(word.Compare))
     {
         var w = word.ToString();
         tags.Add(CreateTagSpan(currenPosition - w.Length, w.Length, type));
     }
 }
Beispiel #2
0
        protected TagSpan <IClassificationTag> CreateTagSpan(int startIndex, int length, NfxTokenTypes type)
        {
            var tokenSpan = new SnapshotSpan(m_Snapshot, new Span(startIndex, length));

            return
                (new TagSpan <IClassificationTag>(tokenSpan,
                                                  new ClassificationTag(m_NfxTypes[type])));
        }
Beispiel #3
0
        protected void FindAdditionalsTokens(List <ITagSpan <IClassificationTag> > tags, NfxTokenTypes type, string text, int start, int length)
        {
            var j    = start;
            var word = new StringBuilder();
            var o    = start + length;

            while (j < o)
            {
                var c = text[j];
                if (char.IsLetter(c))
                {
                    word.Append(c);
                }
                else if (word.Length > 0)
                {
                    Find(word, tags, type, j);
                    word = new StringBuilder();
                }
                if (word.Length > 0 && j + 1 == o)
                {
                    Find(word, tags, type, j);
                }
                j++;
            }
        }