class
LexerThis class is used to read and process expressions in ArgScript.
It contains a map of functions that can be used on expressions (for example, one could have 'sin', 'cos', etc).
Public functions
- auto AddFunction(const char* pFunctionName, IFunction* pFunction) -> void
- Adds a function to this lexer, that will be used when processing expresions.
- auto ExpectChar(LexerString& lexerString, char c) -> void
- Reads one character in the lexer eastl::string, which is expected to be the one specified.
- auto OptionalExpectChar(LexerString& lexerString, char c) -> bool
- Reads one character in the lexer eastl::string, only if the end of the eastl::string has not been reached.
- auto NextParameter(LexerString& lexerString, eastl::string& dst) -> void
- Reads the next parameter in the eastl::string, which is all the characters until a comma, a space, or a closing parenthesis is found.
Protected variables
- eastl::hash_map<eastl::string, IFunction*> mFunctions
Function documentation
void ArgScript:: Lexer:: AddFunction(const char* pFunctionName,
IFunction* pFunction)
Adds a function to this lexer, that will be used when processing expresions.
Parameters | |
---|---|
pFunctionName | The name that will be used to call the function. |
pFunction |
void ArgScript:: Lexer:: ExpectChar(LexerString& lexerString,
char c)
Reads one character in the lexer eastl::string, which is expected to be the one specified.
Parameters | |
---|---|
lexerString | The eastl::string pointer where the character will be read. |
c | The character expected. |
Exceptions | |
ArgScriptException | If the current character in the eastl::string is not the one required. |
If it is not, an exception is thrown.
bool ArgScript:: Lexer:: OptionalExpectChar(LexerString& lexerString,
char c)
Reads one character in the lexer eastl::string, only if the end of the eastl::string has not been reached.
Parameters | |
---|---|
lexerString | The eastl::string pointer where the character will be read. |
c | The character expected. |
Returns | True if the character was read, false if the end of the eastl::string was reached. |
Exceptions | |
ArgScriptException | If the current character in the eastl::string is not the one required. |
The character is expected to be the one specified, otherwise an exception is thrown.
void ArgScript:: Lexer:: NextParameter(LexerString& lexerString,
eastl::string& dst)
Reads the next parameter in the eastl::string, which is all the characters until a comma, a space, or a closing parenthesis is found.
Exceptions | |
---|---|
ArgScriptException | If the format is incorrect (i.e. '(' with no ')', '"' with no closing '"', etc). |
A parameter can also be surrounded by parenthesis.