public IGlobBuilder DirectoryWildcard(PathSeparatorKind?leadingSeparatorKind = PathSeparatorKind.ForwardSlash, PathSeparatorKind?trailingSeparatorKind = PathSeparatorKind.ForwardSlash) { PathSeparatorToken trailingSep = null; PathSeparatorToken leadingSep = null; if (trailingSeparatorKind == null) { trailingSep = null; } else { switch (trailingSeparatorKind) { case PathSeparatorKind.BackwardSlash: trailingSep = new PathSeparatorToken('\\'); break; case PathSeparatorKind.ForwardSlash: trailingSep = new PathSeparatorToken('/'); break; default: break; } } if (leadingSeparatorKind == null) { leadingSep = null; } else { switch (leadingSeparatorKind) { case PathSeparatorKind.BackwardSlash: leadingSep = new PathSeparatorToken('\\'); break; case PathSeparatorKind.ForwardSlash: leadingSep = new PathSeparatorToken('/'); break; default: break; } } _tokens.Add(new WildcardDirectoryToken(leadingSep, trailingSep)); return(this); }
private IGlobToken ReadDirectoryWildcardToken(GlobStringReader reader, PathSeparatorToken leadingPathSeparatorToken) { reader.ReadChar(); if (GlobStringReader.IsPathSeparator(reader.PeekChar())) { reader.ReadChar(); var trailingSeparator = ReadPathSeparatorToken(reader); return(new WildcardDirectoryToken(leadingPathSeparatorToken, trailingSeparator)); } return(new WildcardDirectoryToken(leadingPathSeparatorToken, null)); // this shouldn't happen unless a pattern ends with ** which is weird. **sometext is not legal. }
public void Visit(PathSeparatorToken token) { Success = false; var read = _Reader.Read(); if (read == -1) { return; } var currentChar = (char)read; if (!GlobStringReader.IsPathSeparator(currentChar)) { return; } AddMatch(new GlobTokenMatch() { Token = token, Value = currentChar.ToString() }); }
void IGlobTokenVisitor.Visit(PathSeparatorToken token) { AddMatchGenerator(new PathSeparatorMatchGenerator(token, _random)); }
public IGlobTokenEvaluator CreateTokenEvaluator(PathSeparatorToken token) { return(new PathSeparatorTokenEvaluator(token)); }
public void Visit(PathSeparatorToken token) { AddEvaluator(_evaluatorFactory.CreateTokenEvaluator(token)); }
public PathSeparatorMatchGenerator(PathSeparatorToken token, Random _random) { this.token = token; this._random = _random; }
public PathSeparatorTokenEvaluator(PathSeparatorToken token) { _token = token; }
void IGlobTokenVisitor.Visit(PathSeparatorToken token) { _stringBuilder.Append(token.Value); }
void IGlobTokenVisitor.Visit(PathSeparatorToken token) { _stringBuilder.Append(@"[/\\]"); }
public WildcardDirectoryToken(PathSeparatorToken leadingPathSeparator, PathSeparatorToken trailingPathSeparator) { TrailingPathSeparator = trailingPathSeparator; LeadingPathSeparator = leadingPathSeparator; }