|
Grammatica 1.5 Documentation | |||||||
| FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
System.Object
|
+--Tokenizer
in Tokenizer.csA character stream tokenizer. This class groups the characters read from the stream together into tokens ("words"). The grouping is controlled by token patterns that contain either a fixed string to search for, or a regular expression. If the stream of characters don't match any of the token patterns, a parse exception is thrown.
| Field Summary | |
bool |
UseTokenList
The token list flag property. |
| Constructor Summary | |
Tokenizer( TextReader input )
Creates a new case-sensitive tokenizer for the specified input stream. |
|
Tokenizer( TextReader input, bool ignoreCase )
Creates a new tokenizer for the specified input stream. |
|
| Method Summary | |
void |
AddPattern( TokenPattern pattern )
Adds a new token pattern to the tokenizer. |
int |
GetCurrentColumn()
Returns the current column number. |
int |
GetCurrentLine()
Returns the current line number. |
string |
GetPatternDescription( int id )
Returns a description of the token pattern with the specified id. |
bool |
GetUseTokenList()
Deprecated. Use the UseTokenList property instead. |
protected virtual Token |
NewToken( TokenPattern pattern, string image, int line, int column )
Factory method for creating a new token. |
Token |
Next()
Finds the next token on the stream. |
void |
Reset( TextReader input )
Resets this tokenizer for usage with another input stream. |
void |
SetUseTokenList( bool useTokenList )
Deprecated. Use the UseTokenList property instead. |
override string |
ToString()
Returns a string representation of this object. |
| Field Detail |
public bool UseTokenList;
Token.Previous, Token.Next| Constructor Detail |
public Tokenizer( TextReader input );
input - the input stream to readpublic Tokenizer( TextReader input, bool ignoreCase );
input - the input stream to read
ignoreCase - the character case ignore flag| Method Detail |
public void AddPattern( TokenPattern pattern );
pattern - the pattern to addParserCreationException - if the pattern couldn't be
added to the tokenizerpublic int GetCurrentColumn();
public int GetCurrentLine();
public string GetPatternDescription( int id );
id - the token pattern idpublic bool GetUseTokenList();
Checks if the token list feature is used. The token list feature makes all tokens (including ignored tokens) link to each other in a linked list. By default the token list feature is not used.
UseTokenList, SetUseTokenList, Token.GetPreviousToken, Token.GetNextTokenprotected virtual Token NewToken( TokenPattern pattern, string image, int line, int column );
pattern - the token pattern
image - the token image (i.e. characters)
line - the line number of the first character
column - the column number of the first characterpublic Token Next();
ParseException - if the input stream couldn't be read or
parsed correctlypublic void Reset( TextReader input );
input - the new input stream to readParser.reset(Reader)public void SetUseTokenList( bool useTokenList );
Sets the token list feature flag. The token list feature makes all tokens (including ignored tokens) link to each other in a linked list when active. By default the token list feature is not used.
useTokenList - the token list feature flagUseTokenList, GetUseTokenList, Token.GetPreviousToken, Token.GetNextTokenpublic override string ToString();
|
Grammatica 1.5 Documentation | |||||||
| FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||