org.ourgrid.common.spec.token
Class StringToken
java.lang.Object
org.ourgrid.common.spec.token.Token
org.ourgrid.common.spec.token.StringToken
public class StringToken
- extends Token
It is a Token object that is recognized as a string at the CodesTable.
- See Also:
CodesTable
Method Summary |
static boolean |
isEndOfWord(char theChar,
CharReader reader)
Tells if the next chararacter is a symbol that defines the end of a
string for the commom lexical compiler. |
Token |
readString(CharReader reader,
TokenDelimiter delimiters)
Generalizes the token reading process when considering the token
delimiters desired. |
Token |
readStringToken(java.lang.String firstPart,
CharReader reader)
Check if the character passed as paramether is part of a string. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
StringToken
public StringToken()
readStringToken
public Token readStringToken(java.lang.String firstPart,
CharReader reader)
throws java.io.IOException
- Check if the character passed as paramether is part of a string. This
method of reading string considers many symbols as end-of-word. Check
symbol at method "this.isEndOfWord()"
- Parameters:
firstPart
- - Is the String that probably begins the StringToken
symbolreader
- - Is the reader that controls the character reading process
from source.
- Returns:
- A Token object if a string was recognized beggining with
"firstPart"; or "null" if it was not.
- Throws:
java.io.IOException
- See Also:
CodesTable
readString
public Token readString(CharReader reader,
TokenDelimiter delimiters)
throws SpecialCharException,
java.io.IOException
- Generalizes the token reading process when considering the token
delimiters desired.
- Parameters:
reader
- the reader able to get the characters from source.delimiters
- the delimiter's set
- Returns:
- A token where the token's symbol is the "string read"
- Throws:
java.io.IOException
SpecialCharException
- If a back slash is found a no special char
was recognized.
isEndOfWord
public static boolean isEndOfWord(char theChar,
CharReader reader)
throws java.io.IOException
- Tells if the next chararacter is a symbol that defines the end of a
string for the commom lexical compiler. OBS.: If the character is found
as a End-Of-Word then it will be unread!
- Parameters:
theChar
- The character to be analyzed.reader
- The reader used to read the source.
- Returns:
- Will return true if the next char is any of this symbols: blanck
space, tab, end of line, '\t', ';', '{', '}', '(', ')', ':'; that
are symbols that represents a end of a string.
- Throws:
java.io.IOException
- Thrown if could not unread a char from the "reader".