private void Compile() { if (_root != null) { return; } var parser = new Parser(this.Pattern); _root = parser.Parse(); //TODO: this is basically cheating and probably not efficient but it works for now. _regex = new Regex(GlobToRegexVisitor.Process(_root), RegexOptions.Compiled); }
private void Compile() { if (_root != null) { return; } if (_regex != null) { return; } var parser = new Parser(this.Pattern); _root = parser.Parse(); var regexPattern = GlobToRegexVisitor.Process(_root); _regex = new Regex(regexPattern, _options == GlobOptions.Compiled ? RegexOptions.Compiled | RegexOptions.Singleline : RegexOptions.Singleline); }