PerCederberg.Grammatica.Parser.RE
Class RepeatElement
ICloneable
|
+--Element
|
+--RepeatElement
in RepeatElement.cs
- class RepeatElement
- extends Element
A regular expression element repeater. The element repeats the
matches from a specified element, attempting to reach the
maximum repetition count.
Method Summary |
override object |
Clone()
Creates a copy of this element. |
override int |
Match( Matcher m, string str, int start, int skip )
Returns the length of a matching string starting at the
specified position. |
override void |
PrintTo( TextWriter output, string indent )
Prints this element to the specified output stream. |
RepeatElement
public RepeatElement( Element elem, int min, int max, RepeatElement.RepeatType type );
- Creats a new element repeater.
- Parameters:
elem
- the element to repeat
min
- the minimum count
max
- the maximum count
type
- the repeat type constant
Clone
public override 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 override 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.
- 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 override 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