Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SearchStatus"/> class
 /// </summary>
 /// <param name="context">The search context</param>
 /// <param name="reader">The reader to be read from</param>
 /// <param name="activeRanges">The stack of active ranges</param>
 /// <param name="foundToken">The found special token</param>
 private SearchStatus(
     [NotNull] SearchContext context,
     [NotNull] ILineReader reader,
     [NotNull, ItemNotNull] Stack <IRangeSearcher> activeRanges,
     [CanBeNull] SpecialTokenInfo foundToken)
 {
     _context      = context;
     _reader       = reader;
     _activeRanges = activeRanges;
     _foundToken   = foundToken;
 }
Exemple #2
0
        private static SpecialTokenInfo FindToken([NotNull] ILineReader reader, [NotNull, ItemNotNull] IEnumerable <ISpecialTokenSearcher> searchers)
        {
            SpecialTokenInfo result = null;

            foreach (var searcher in searchers)
            {
                var searcherResult = searcher.Find(reader);
                if (searcherResult != null && (result == null || result.Index > searcherResult.Index))
                {
                    result = searcherResult;
                }
            }

            return(result);
        }