예제 #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(SearchContext context,
                      ILineReader reader,
                      Stack <IRangeSearcher> activeRanges,
                      SpecialTokenInfo foundToken)
 {
     _context      = context;
     _reader       = reader;
     _activeRanges = activeRanges;
     _foundToken   = foundToken;
 }
예제 #2
0
        /// <summary>
        ///     Search a special token
        /// </summary>
        /// <param name="reader">The reader where the token should be searched in</param>
        /// <param name="searchers">The collection of searchers to test</param>
        /// <returns><c>null</c> when no token could be found</returns>

        private static SpecialTokenInfo FindToken(ILineReader reader,
                                                  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);
        }