示例#1
0
        public CompositeEvaluator(IReadOnlyList <Token> tokens, int startTokenIndex, EvaluatorFactory factory, out int nextTokenIndex)
        {
            MinimumMatchLength  = 0;
            HasFixedMatchLength = true;

            var evaluators = new List <IEvaluator>();

            nextTokenIndex = startTokenIndex;
            while (nextTokenIndex < tokens.Count)
            {
                var evaluator = factory.CreateEvaluator(tokens, nextTokenIndex, out nextTokenIndex);
                evaluators.Add(evaluator);

                MinimumMatchLength  += evaluator.MinimumMatchLength;
                HasFixedMatchLength &= evaluator.HasFixedMatchLength;
            }
            _evaluators        = evaluators.AsReadOnly();
            SubEvaluatorsCount = _evaluators.Count;

            nextTokenIndex = tokens.Count;
        }
 public DirectoryWildcardEvaluator(IReadOnlyList <Token> tokens, int tokenIndex, EvaluatorFactory factory, out int nextTokenIndex)
 {
     _token = tokens[tokenIndex];
     _followingEvaluator         = new CompositeEvaluator(tokens, tokenIndex + 1, factory, out nextTokenIndex);
     _containsFollowingSeparator = _token.Value[_token.Value.Length - 1].IsDirectorySeparator();
 }
示例#3
0
 public TokenReader(IReadOnlyList <Token> tokens)
 {
     _tokens  = tokens;
     _factory = new EvaluatorFactory();
 }
示例#4
0
 public WildcardEvaluator(IReadOnlyList <Token> tokens, int tokenIndex, EvaluatorFactory factory, out int nextTokenIndex)
 {
     _token = tokens[tokenIndex];
     _followingEvaluator = new CompositeEvaluator(tokens, tokenIndex + 1, factory, out nextTokenIndex);
 }