Class CLexer#
Defined in File lexer.h
Class Documentation#
-
class CLexer#
SDV IDL lexer class.
Public Types
Public Functions
-
CLexer(ILexerCallback *pCallback, bool bCaseSensitive, ELexingMode eLexingMode = ELexingMode::lexing_idl)#
Constructor.
- Parameters:
pCallback – [in] Pointer to the lexer callback interface. Must not be NULL.
bCaseSensitive – [in] When set, allow identical names that only differ in case.
eLexingMode – [in] The lexing mode the lexer should run in. This determines the rule-set to use while lexing.
-
virtual ~CLexer() = default#
Destructor.
-
void AddKeyword(const std::string &rssKeyword)#
Add keywords to the reserved keyword list (based on the enabled extension).
- Parameters:
rssKeyword – [in] Reference to the keyword string to add.
-
CToken GetToken(CCodePos &rCode, const CContextPtr &rptrContext) const#
Get a token from the code.
Remark
Whitespace, comments and preprocessor directions are not provided as a result, but are provided through the callback interface.
- Parameters:
rCode – [inout] Reference to the code to be parsed.
rptrContext – [in] Reference to the smart pointer to the source code context.
- Throws:
Throws – CCompileException on parse error.
- Post:
Updates the position to the token following the token.
- Returns:
Returns the read token or an empty token when OEF has been reached.
-
const CToken &GetLastValidToken() const#
Get the last valid token.
- Returns:
Returns a reference to the member variable containing the last read token or an empty token when no token was read before.
-
CToken GetCustom(CCodePos &rCode, char cSymbol) const#
Read until the provided symbol or the end of the text.
- Parameters:
rCode – [inout] Reference to the code to be parsed.
cSymbol – [in] The symbol to mark the end.
- Post:
Updates the position to the token of the symbol.
- Returns:
Returns the token until the symbol or end of text has been reached.
-
void SkipLine(CCodePos &rCode) const#
Skip the rest of the line.
Remark
End position is at the carriage return or newline for preprocessing directives and past the carriage return or newline for code.
Remark
Sets the newline-occurred flag for code.
Remark
Back-slash at the end of the line causes the inclusion of the next line.
- Parameters:
rCode – [inout] Reference to the code to be parsed.
-
void EnablePreprocProcessing()#
Enable preproc processing.
While parsing preprocessor directive, further preprocessor processing is disabled. If including an additional file, preprocessing needs to be enabled again.
-
CLexer(ILexerCallback *pCallback, bool bCaseSensitive, ELexingMode eLexingMode = ELexingMode::lexing_idl)#