PerCederberg.Grammatica.Runtime.RE
Class Element
ICloneable
|
+--Element
in Element.cs
- Direct Known Subclasses:
- AlternativeElement, CharacterSetElement, CombineElement, RepeatElement, StringElement
- internal abstract 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, ReaderBuffer buffer, 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, ReaderBuffer buffer, 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
buffer - the input character buffer 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
- Throws:
IOException - if an I/O error occurred
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