Public Member Functions | |
| Lexer (const File *file) | |
| Create the lexer and fill the keywords table. | |
| ~Lexer () | |
| Free everything. | |
| void | Next () |
| Read the next character into 'current_char'. | |
| Token | GetToken () const |
| Get the current token. | |
| const char * | GetString () const |
| Read the currenty processed string. | |
| void | Lex () |
| Perform the lexing/tokenizing of the file till we can return something that must be parsed. | |
Private Member Functions | |
| Token | FindKeyword (const char *name) const |
| The token based on keyword with a given name. | |
| void | ReadIdentifier () |
| Read an identifier. | |
| void | ReadString (char end, Token token) |
| Read a string up to a given character, then set the given token. | |
Private Attributes | |
| const File * | file |
| The file to read from. | |
| char | current_char |
| The current character to process. | |
| char * | string |
| Currently processed string. | |
| Token | token |
| The current token to process. | |
| char * | buf |
| Temporary buffer. | |
| size_t | buf_len |
| Length of the temporary buffer. | |
| KeywordList | keywords |
| All keywords we know of. | |
Lexer of a file.
Definition at line 158 of file depend.cpp.
| Lexer::Lexer | ( | const File * | file | ) | [inline] |
| Token Lexer::FindKeyword | ( | const char * | name | ) | const [inline, private] |
The token based on keyword with a given name.
| name | the actual keyword. |
Definition at line 346 of file depend.cpp.
References keywords, and TOKEN_IDENTIFIER.
Referenced by ReadIdentifier().
| const char* Lexer::GetString | ( | ) | const [inline] |
Read the currenty processed string.
Definition at line 212 of file depend.cpp.
References string.
Referenced by ExpressionDefined(), and ScanFile().
| Token Lexer::GetToken | ( | ) | const [inline] |
Get the current token.
Definition at line 203 of file depend.cpp.
References token.
Referenced by ExpressionAnd(), ExpressionDefined(), ExpressionNot(), ExpressionOr(), and ScanFile().
| void Lexer::ReadString | ( | char | end, | |
| Token | token | |||
| ) | [inline, private] |
Read a string up to a given character, then set the given token.
| end | the 'marker' for the end of the string. | |
| token | the token to set after returning. |
Definition at line 383 of file depend.cpp.
References buf, buf_len, current_char, and Next().
Referenced by Lex().
1.7.1