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

PerCederberg.Grammatica.Parser.RE
Class StringElement

ICloneable
   |
   +--Element
         |
         +--StringElement

   in StringElement.cs

class StringElement
extends Element

A regular expression string element. This element only matches an exact string. Once created, the string element is immutable.


Constructor Summary
StringElement( char c )
          Creates a new string element.
StringElement( string str )
          Creates a new string element.
 
Method Summary
 override object Clone()
          Returns this element as it is immutable.
 string GetString()
          Returns the string to be matched.
 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

StringElement

public StringElement( char c );
Creates a new string element.
Parameters:
c - the character to match with

StringElement

public StringElement( string str );
Creates a new string element.
Parameters:
str - the string to match with


Method Detail

Clone

public override object Clone();
Returns this element as it is immutable.
Returns:
this string element

GetString

public string GetString();
Returns the string to be matched.
Returns:
the string to be matched

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