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

PerCederberg.Grammatica.Runtime
Class TokenPattern

System.Object
   |
   +--TokenPattern

   in TokenPattern.cs

public class TokenPattern
extends System.Object

A token pattern. This class contains the definition of a token (i.e. it's pattern), and allows testing a string against this pattern. A token pattern is uniquely identified by an integer id, that must be provided upon creation.


Inner Classes, Typedefs, and Enums
enum TokenPattern.PatternType
          The pattern type enumeration.
 
Field Summary
 string DebugInfo
          The token debug info message property.
 bool Error
          The error flag property.
 string ErrorMessage
          The token error message property.
 int Id
          The token pattern identity property (read-only).
 bool Ignore
          The ignore flag property.
 string IgnoreMessage
          The token ignore message property.
 string Name
          The token pattern name property (read-only).
 string Pattern
          The token pattern property (read-only).
 TokenPattern.PatternType Type
          The token pattern type property (read-only).
 
Constructor Summary
TokenPattern( int id, string name, TokenPattern.PatternType type, string pattern )
          Creates a new token pattern.
 
Method Summary
 string GetErrorMessage()
          Deprecated. Use the ErrorMessage property instead.
 int GetId()
          Deprecated. Use the Id property instead.
 string GetIgnoreMessage()
          Deprecated. Use the IgnoreMessage property instead.
 string GetName()
          Deprecated. Use the Name property instead.
 string GetPattern()
          Deprecated. Use the Pattern property instead.
 TokenPattern.PatternType GetPatternType()
          Deprecated. Use the Type property instead.
 bool IsError()
          Deprecated. Use the Error property instead.
 bool IsIgnore()
          Deprecated. Use the Ignore property instead.
 void SetError()
          Deprecated. Use the Error property instead.
 void SetError( string message )
          Deprecated. Use the ErrorMessage property instead.
 void SetIgnore()
          Deprecated. Use the Ignore property instead.
 void SetIgnore( string message )
          Deprecated. Use the IgnoreMessage property instead.
 string ToShortString()
          Returns a short string representation of this object.
 override string ToString()
          Returns a string representation of this object.
 

Field Detail

DebugInfo

public string DebugInfo;
The token debug info message property. This is normally be set when the token pattern is analyzed by the tokenizer.
Since:
1.5

Error

public bool Error;
The error flag property. If this property is true, the token pattern corresponds to an error token and an error should be reported if a match is found. When setting this property to true, a default error message is created if none was previously set.
Since:
1.5

ErrorMessage

public string ErrorMessage;
The token error message property. The error message is printed whenever the token is matched. Setting the error message property also sets the error flag to true.
Since:
1.5
See Also:
Error

Id

public int Id;
The token pattern identity property (read-only). This property contains the unique token pattern identity value.
Since:
1.5

Ignore

public bool Ignore;
The ignore flag property. If this property is true, the token pattern corresponds to an ignore token and should be skipped if a match is found.
Since:
1.5

IgnoreMessage

public string IgnoreMessage;
The token ignore message property. The ignore message is printed whenever the token is matched. Setting the ignore message property also sets the ignore flag to true.
Since:
1.5
See Also:
Ignore

Name

public string Name;
The token pattern name property (read-only).
Since:
1.5

Pattern

public string Pattern;
The token pattern property (read-only). This property contains the actual pattern (string or regexp) which have to be matched.
Since:
1.5

Type

public TokenPattern.PatternType Type;
The token pattern type property (read-only).
Since:
1.5


Constructor Detail

TokenPattern

public TokenPattern( int id, string name, TokenPattern.PatternType type, string pattern );
Creates a new token pattern.
Parameters:
id - the token pattern id
name - the token pattern name
type - the token pattern type
pattern - the token pattern


Method Detail

GetErrorMessage

public string GetErrorMessage();
Deprecated. Use the ErrorMessage property instead.

Returns the token error message if the pattern corresponds to an error token.

Returns:
the token error message
See Also:
ErrorMessage

GetId

public int GetId();
Deprecated. Use the Id property instead.

Returns the unique token pattern identity value.

Returns:
the token pattern id
See Also:
Id

GetIgnoreMessage

public string GetIgnoreMessage();
Deprecated. Use the IgnoreMessage property instead.

Returns the token ignore message if the pattern corresponds to an ignored token.

Returns:
the token ignore message
See Also:
IgnoreMessage

GetName

public string GetName();
Deprecated. Use the Name property instead.

Returns the token pattern name.

Returns:
the token pattern name
See Also:
Name

GetPattern

public string GetPattern();
Deprecated. Use the Pattern property instead.

Returns te token pattern.

Returns:
the token pattern
See Also:
Pattern

GetPatternType

public TokenPattern.PatternType GetPatternType();
Deprecated. Use the Type property instead.

Returns the token pattern type.

Returns:
the token pattern type
See Also:
Type

IsError

public bool IsError();
Deprecated. Use the Error property instead.

Checks if the pattern corresponds to an error token. If this is true, it means that an error should be reported if a matching token is found.

Returns:
true if the pattern maps to an error token, or false otherwise
See Also:
Error

IsIgnore

public bool IsIgnore();
Deprecated. Use the Ignore property instead.

Checks if the pattern corresponds to an ignored token. If this is true, it means that the token should be ignored if found.

Returns:
true if the pattern maps to an ignored token, or false otherwise
See Also:
Ignore

SetError

public void SetError();
Deprecated. Use the Error property instead.

Sets the token error flag and assigns a default error message.

See Also:
Error

SetError

public void SetError( string message );
Deprecated. Use the ErrorMessage property instead.

Sets the token error flag and assigns the specified error message.

Parameters:
message - the error message to display
See Also:
ErrorMessage

SetIgnore

public void SetIgnore();
Deprecated. Use the Ignore property instead.

Sets the token ignore flag and clears the ignore message.

See Also:
Ignore

SetIgnore

public void SetIgnore( string message );
Deprecated. Use the IgnoreMessage property instead.

Sets the token ignore flag and assigns the specified ignore message.

Parameters:
message - the ignore message to display
See Also:
IgnoreMessage

ToShortString

public string ToShortString();
Returns a short string representation of this object.
Returns:
a short string representation of this object

ToString

public override string ToString();
Returns a string representation of this object.
Returns:
a token pattern string representation

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