OpenTTD
|
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 244 of file depend.cpp.
|
inline |
Create the lexer and fill the keywords table.
file | the file to read from. |
Definition at line 250 of file depend.cpp.
References buf, buf_len, keywords, Next(), TOKEN_DEFINE, TOKEN_DEFINED, TOKEN_ELIF, TOKEN_ELSE, TOKEN_ENDIF, TOKEN_IF, TOKEN_IFDEF, TOKEN_IFNDEF, TOKEN_INCLUDE, and TOKEN_UNDEF.
|
inlineprivate |
The token based on keyword with a given name.
name | the actual keyword. |
Definition at line 432 of file depend.cpp.
References keywords, and TOKEN_IDENTIFIER.
Referenced by ReadIdentifier().
|
inline |
Read the currenty processed string.
Definition at line 298 of file depend.cpp.
References string.
Referenced by ExpressionDefined(), and ScanFile().
|
inline |
Get the current token.
Definition at line 289 of file depend.cpp.
References token.
Referenced by ExpressionAnd(), ExpressionDefined(), ExpressionNot(), ExpressionOr(), and ScanFile().
|
inlineprivate |
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 469 of file depend.cpp.
References buf, buf_len, current_char, free(), Next(), and token.
Referenced by Lex().