|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.percederberg.grammatica.parser.TokenPattern
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.
Field Summary | |
static int |
REGEXP_TYPE
The regular expression pattern type. |
static int |
STRING_TYPE
The string pattern type. |
Constructor Summary | |
TokenPattern(int id,
java.lang.String name,
int type,
java.lang.String pattern)
Creates a new token pattern. |
Method Summary | |
java.lang.String |
getErrorMessage()
Returns the token error message if the pattern corresponds to an error token. |
int |
getId()
Returns the unique token pattern identity value. |
java.lang.String |
getIgnoreMessage()
Returns the token ignore message if the pattern corresponds to an ignored token. |
java.lang.String |
getName()
Returns the token pattern name. |
java.lang.String |
getPattern()
Returns te token pattern. |
int |
getType()
Returns the token pattern type. |
boolean |
isError()
Checks if the pattern corresponds to an error token. |
boolean |
isIgnore()
Checks if the pattern corresponds to an ignored token. |
void |
setError()
Sets the token error flag and assigns a default error message. |
void |
setError(java.lang.String message)
Sets the token error flag and assigns the specified error message. |
void |
setIgnore()
Sets the token ignore flag and clears the ignore message. |
void |
setIgnore(java.lang.String message)
Sets the token ignore flag and assigns the specified ignore message. |
java.lang.String |
toShortString()
Returns a short string representation of this object. |
java.lang.String |
toString()
Returns a detailed string representation of this object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int STRING_TYPE
public static final int REGEXP_TYPE
Constructor Detail |
public TokenPattern(int id, java.lang.String name, int type, java.lang.String pattern)
id
- the token pattern idname
- the token pattern nametype
- the token pattern typepattern
- the token patternMethod Detail |
public boolean isError()
public boolean isIgnore()
public int getId()
public java.lang.String getName()
public int getType()
STRING_TYPE
,
REGEXP_TYPE
public java.lang.String getPattern()
public java.lang.String getErrorMessage()
public java.lang.String getIgnoreMessage()
public void setError()
public void setError(java.lang.String message)
message
- the error message to displaypublic void setIgnore()
public void setIgnore(java.lang.String message)
message
- the ignore message to displaypublic java.lang.String toString()
public java.lang.String toShortString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |