PerCederberg.Grammatica.Parser.RE
Class Element
ICloneable
|
+--Element
in Element.cs
- Direct Known Subclasses:
- AlternativeElement, CharacterSetElement, CombineElement, RepeatElement, StringElement
- class Element
- extends ICloneable
A regular expression element. This is the common base class for
all regular expression elements, i.e. the parts of the regular
expression.
Method Summary |
abstract object |
Clone()
Creates a copy of this element. |
abstract int |
Match( Matcher m, string str, int start, int skip )
Returns the length of a matching string starting at the
specified position. |
abstract void |
PrintTo( TextWriter output, string indent )
Prints this element to the specified output stream. |
Clone
public abstract object Clone();
- Creates a copy of this element. The copy will be an
instance of the same class matching the same strings.
Copies of elements are necessary to allow elements to cache
intermediate results while matching strings without
interfering with other threads.
- Returns:
- a copy of this element
Match
public abstract int Match( Matcher m, string str, int start, int skip );
- Returns the length of a matching string starting at the
specified position. The number of matches to skip can also
be specified, but numbers higher than zero (0) cause a
failed match for any element that doesn't attempt to
combine other elements.
- Parameters:
m
- the matcher being used
str
- the string to match
start
- the starting position
skip
- the number of matches to skip
- Returns:
- the length of the matching string, or
-1 if no match was found
PrintTo
public abstract void PrintTo( TextWriter output, string indent );
- Prints this element to the specified output stream.
- Parameters:
output
- the output stream to use
indent
- the current indentation