C# Class Lucene.Net.Util.Automaton.RegExp

Regular Expression extension to Automaton.

Regular expressions are built from the following abstract syntax:

regexp ::= unionexp
|
unionexp ::= interexp | unionexp (union)
| interexp
interexp ::= concatexp & interexp (intersection) [OPTIONAL]
| concatexp
concatexp ::= repeatexp concatexp (concatenation)
| repeatexp
repeatexp ::= repeatexp ? (zero or one occurrence)
| repeatexp * (zero or more occurrences)
| repeatexp + (one or more occurrences)
| repeatexp {n} (n occurrences)
| repeatexp {n,} (n or more occurrences)
| repeatexp {n,m} (n to m occurrences, including both)
| complexp
complexp ::= ~ complexp (complement) [OPTIONAL]
| charclassexp
charclassexp ::= [ charclasses ] (character class)
| [^ charclasses ] (negated character class)
| simpleexp
charclasses ::= charclass charclasses
| charclass
charclass ::= charexp - charexp (character range, including end-points)
| charexp
simpleexp ::= charexp
| . (any single character)
| # (the empty language) [OPTIONAL]
| @ (any string) [OPTIONAL]
| " <Unicode string without double-quotes>  " (a string)
| ( ) (the empty string)
| ( unionexp ) (precedence override)
| < <identifier> > (named automaton) [OPTIONAL]
| <n-m> (numerical interval) [OPTIONAL]
charexp ::= <Unicode character> (a single non-reserved character)
| \ <Unicode character>  (a single character)

The productions marked [OPTIONAL] are only allowed if specified by the syntax flags passed to the RegExp constructor. The reserved characters used in the (enabled) syntax must be escaped with backslash (\) or double-quotes ("..."). (In contrast to other regexp syntaxes, this is required also in character classes.) Be aware that dash (-) has a special meaning in charclass expressions. An identifier is a string not containing right angle bracket (>) or dash (-). Numerical intervals are specified by non-negative decimal integers and include both end points, and if n and m have the same number of digits, then the conforming strings must have that length (i.e. prefixed by 0's). @lucene.experimental

Mostra file Open project: paulirwin/lucene.net Class Usage Examples

Public Methods

Method Description
RegExp ( string s ) : Lucene.Net.Support

Constructs new RegExp from a string. Same as RegExp(s, ALL).

RegExp ( string s, int syntax_flags ) : Lucene.Net.Support

Constructs new RegExp from a string.

SetAllowMutate ( bool flag ) : bool

Sets or resets allow mutate flag. If this flag is set, then automata construction uses mutable automata, which is slightly faster but not thread safe. By default, the flag is not set.

ToAutomaton ( ) : Automaton

Constructs new Automaton from this RegExp. Same as toAutomaton(null) (empty automaton map).

ToAutomaton ( AutomatonProvider automaton_provider ) : Automaton

Constructs new Automaton from this RegExp. The constructed automaton is minimal and deterministic and has no transitions to dead states.

ToAutomaton ( Automaton>.IDictionary automata ) : Automaton

Constructs new Automaton from this RegExp. The constructed automaton is minimal and deterministic and has no transitions to dead states.

ToString ( ) : string

Constructs string from parsed regular expression.

Private Methods

Method Description
Check ( int flag ) : bool
FindLeaves ( RegExp exp, Kind kind, IList list, Automaton>.IDictionary automata, AutomatonProvider automaton_provider ) : void
GetIdentifiers ( ISet set ) : void
MakeAnyChar ( ) : RegExp
MakeAnyString ( ) : RegExp
MakeAutomaton ( string s ) : RegExp
MakeChar ( int c ) : RegExp
MakeCharRange ( int from, int to ) : RegExp
MakeComplement ( RegExp exp ) : RegExp
MakeConcatenation ( RegExp exp1, RegExp exp2 ) : RegExp
MakeEmpty ( ) : RegExp
MakeIntersection ( RegExp exp1, RegExp exp2 ) : RegExp
MakeInterval ( int min, int max, int digits ) : RegExp
MakeOptional ( RegExp exp ) : RegExp
MakeRepeat ( RegExp exp ) : RegExp
MakeRepeat ( RegExp exp, int min ) : RegExp
MakeRepeat ( RegExp exp, int min, int max ) : RegExp
MakeString ( RegExp exp1, RegExp exp2 ) : RegExp
MakeString ( string s ) : RegExp
MakeUnion ( RegExp exp1, RegExp exp2 ) : RegExp
Match ( int c ) : bool
More ( ) : bool
Next ( ) : int
ParseCharClass ( ) : RegExp
ParseCharClassExp ( ) : RegExp
ParseCharClasses ( ) : RegExp
ParseCharExp ( ) : int
ParseComplExp ( ) : RegExp
ParseConcatExp ( ) : RegExp
ParseInterExp ( ) : RegExp
ParseRepeatExp ( ) : RegExp
ParseSimpleExp ( ) : RegExp
ParseUnionExp ( ) : RegExp
Peek ( string s ) : bool
RegExp ( ) : Lucene.Net.Support
ToAutomaton ( Automaton>.IDictionary automata, AutomatonProvider automaton_provider ) : Automaton
ToAutomatonAllowMutate ( Automaton>.IDictionary automata, AutomatonProvider automaton_provider ) : Automaton
ToStringBuilder ( StringBuilder b ) : StringBuilder

Method Details

RegExp() public method

Constructs new RegExp from a string. Same as RegExp(s, ALL).
if an error occured while parsing the /// regular expression
public RegExp ( string s ) : Lucene.Net.Support
s string regexp string
return Lucene.Net.Support

RegExp() public method

Constructs new RegExp from a string.
if an error occured while parsing the /// regular expression
public RegExp ( string s, int syntax_flags ) : Lucene.Net.Support
s string regexp string
syntax_flags int boolean 'or' of optional syntax constructs to be /// enabled
return Lucene.Net.Support

SetAllowMutate() public method

Sets or resets allow mutate flag. If this flag is set, then automata construction uses mutable automata, which is slightly faster but not thread safe. By default, the flag is not set.
public SetAllowMutate ( bool flag ) : bool
flag bool if true, the flag is set
return bool

ToAutomaton() public method

Constructs new Automaton from this RegExp. Same as toAutomaton(null) (empty automaton map).
public ToAutomaton ( ) : Automaton
return Automaton

ToAutomaton() public method

Constructs new Automaton from this RegExp. The constructed automaton is minimal and deterministic and has no transitions to dead states.
if this regular expression uses a named /// identifier that is not available from the automaton provider
public ToAutomaton ( AutomatonProvider automaton_provider ) : Automaton
automaton_provider AutomatonProvider provider of automata for named identifiers
return Automaton

ToAutomaton() public method

Constructs new Automaton from this RegExp. The constructed automaton is minimal and deterministic and has no transitions to dead states.
if this regular expression uses a named /// identifier that does not occur in the automaton map
public ToAutomaton ( Automaton>.IDictionary automata ) : Automaton
automata Automaton>.IDictionary a map from automaton identifiers to automata (of type /// Automaton).
return Automaton

ToString() public method

Constructs string from parsed regular expression.
public ToString ( ) : string
return string