Overview   Project   Class   Tree   Deprecated   Index 
Grammatica 1.3 Documentation
FRAMES    NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD

PerCederberg.Grammatica.Parser.RE
Class CombineElement

ICloneable
   |
   +--Element
         |
         +--CombineElement

   in CombineElement.cs

class CombineElement
extends Element

A regular expression combination element. This element matches two consecutive elements.


Constructor Summary
CombineElement( Element first, Element second )
          Creates a new combine element.
 
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.
   
Methods inherited from class Element
Clone, Match, PrintTo
 

Constructor Detail

CombineElement

public CombineElement( Element first, Element second );
Creates a new combine element.
Parameters:
first - the first element
second - the second element


Method Detail

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, 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 longest 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

 Overview   Project   Class   Tree   Deprecated   Index 
Grammatica 1.3 Documentation
FRAMES    NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD