/// <summary> /// Constructs new <see cref="RegExp"/> from a string. /// </summary> /// <param name="s"> Regexp string. </param> /// <param name="syntax_flags"> Boolean 'or' of optional <see cref="RegExpSyntax"/> constructs to be /// enabled. </param> /// <exception cref="ArgumentException"> If an error occured while parsing the /// regular expression </exception> public RegExp(string s, RegExpSyntax syntax_flags) { b = s; flags = syntax_flags; RegExp e; if (s.Length == 0) { e = MakeString(""); } else { e = ParseUnionExp(); if (pos < b.Length) { throw new ArgumentException("end-of-string expected at position " + pos); } } kind = e.kind; exp1 = e.exp1; exp2 = e.exp2; this.s = e.s; c = e.c; min = e.min; max = e.max; digits = e.digits; from = e.from; to = e.to; b = null; }
internal DumbRegexpQuery(Term term, RegExpSyntax flags) : base(term.Field) { RegExp re = new RegExp(term.Text, flags); automaton = re.ToAutomaton(); }
/// <summary> /// Constructs a query for terms matching <paramref name="term"/>. /// </summary> /// <param name="term"> Regular expression. </param> /// <param name="flags"> Optional <see cref="RegExp"/> features from <see cref="RegExpSyntax"/> </param> /// <param name="provider"> Custom <see cref="IAutomatonProvider"/> for named automata </param> public RegexpQuery(Term term, RegExpSyntax flags, IAutomatonProvider provider) : base(term, (new RegExp(term.Text(), flags)).ToAutomaton(provider)) { }
/// <summary> /// Constructs a query for terms matching <paramref name="term"/>. /// </summary> /// <param name="term"> Regular expression. </param> /// <param name="flags"> Optional <see cref="RegExp"/> features from <see cref="RegExpSyntax"/> </param> public RegexpQuery(Term term, RegExpSyntax flags) : this(term, flags, defaultProvider) { }
private bool Check(RegExpSyntax flag) { return((flags & flag) != 0); }