-
首页
-
C4D R23.110 C++ SDK
LexerInterface Class Reference
IO
#include <lexer.h>
详细描述
Lexer class. This class provides functionality to scan text files. the stream is tokenized for easy reading.
成员函数文档编制
◆
MAXON_INTERFACE_NONVIRTUAL()
◆
Alloc()
-
参数
-
[in]
|
allocLocation
|
Source location.
|
◆
Init()
Initializes the lexer class. This functions opens the stream.
-
参数
-
[in]
|
fileName
|
Url
or Input Stream.
|
[in]
|
flags
|
Control flags for the lexer. See LEXERINITFLAGS for description.
|
[in]
|
stringEscapeCharacters
|
Defines characters that allow to escape " ' and the escape character itself within strings. By Default this is '\'.
|
[in]
|
stringDecoding
|
String
encoding for this file. If a nullptr is passed (recommended) then StreamConversions::UtfTextDecoder will be used to auto-detect the file encoding.
|
-
返回
-
OK on success.
◆
AddOperator()
Adds an operator symbol to the lexer. This is a symbol which consists of several non-letter characters such as && or +=. The lexer will then return such a character sequence as a single symbol of type
LEXERSYMBOL::OPERATOR
.
-
参数
-
[in]
|
chars
|
The symbol to add.
|
◆
Close()
Closes the stream.
◆
ReadNextChar()
Reads the next character out of the stream.
-
返回
-
Returns the character that has been read. This function returns 0 if the end of the file has been reached.
◆
SkipSpaces()
Skips the spaces from the current position.
-
返回
-
True if the function was successful. False if the end of the file has been reached.
◆
SkipLineToEnd()
Skips line to the end. If the lexer is in NEED_EOL mode the method stops at line end. Otherwise it will advance to the next line and stops when non-whitespace is found.
-
参数
-
[in]
|
collectSkipped
|
If true then the skipped bytes are returned with the next
GetIdent()
call.
|
-
返回
-
True if the function was successful. False if the end of the file has been reached. Otherwise an error.
◆
ReadNextSymbol()
Reads the next symbol in the stream.
GetIdent()
returns the name of the symbol/ident/number/operator.
-
参数
-
[in]
|
flags
|
See LEXERSYMBOLFLAGS for details.
|
-
返回
-
Next detected symbol.
LEXERSYMBOL::ENDOFFILE
if the end of file has been reached.
◆
ReadNextSymbolExpected()
Reads the next symbol in the stream and checks if it's identical to requiredSymbols.
GetIdent()
returns the name of the symbol/ident/number/operator.
-
参数
-
[in]
|
expectedSymbols
|
Symbol that is required.
|
[in]
|
flags
|
See LEXERSYMBOLFLAGS for details.
|
-
返回
-
Next detected symbol.
LEXERSYMBOL::ENDOFFILE
if the end of file has been reached.
◆
RewindSymbol()
Rewinds the current symbol so that the next ReadNextSymbol returns exactly the same as before.
◆
GetSymbol()
Returns the current symbol.
◆
GetLeadingSpace()
Returns the number of leading spaces of the symbol. Tabs count as up to 8 spaces.
◆
GetIdent()
Returns the current
String
ident.
◆
GetFloat()
[1/2]
In case of
LEXERSYMBOL::NUMBER
this function returns the floating point value of this number.
-
参数
-
[out]
|
val
|
Reference to the value.
|
◆
GetFloat()
[2/2]
In case of
LEXERSYMBOL::NUMBER
this function returns the floating point value of this number.
-
参数
-
[in]
|
val
|
Reference to the value.
|
◆
GetInt()
[1/2]
In case of
LEXERSYMBOL::NUMBER
this function returns the integer value of this number.
-
参数
-
[in]
|
val
|
Reference to the value.
|
◆
GetInt()
[2/2]
In case of
LEXERSYMBOL::NUMBER
this function returns the integer value of this number.
-
参数
-
[in]
|
val
|
Reference to the value.
|
◆
GetUInt()
[1/2]
In case of
LEXERSYMBOL::NUMBER
this function returns the integer value of this number.
-
参数
-
[in]
|
val
|
Reference to the value.
|
◆
GetUInt()
[2/2]
In case of
LEXERSYMBOL::NUMBER
this function returns the integer value of this number.
-
参数
-
[in]
|
val
|
Reference to the value.
|
◆
GetCurrentReadPosition()
Returns the current reading position.
◆
GetSymbolPosition()
Returns the position of the current symbol.
-
返回
-
The position of the current symbol.
◆
CheckIdent()
[1/2]
Checks against the current identifier.
-
参数
-
[in]
|
cmp
|
C-style string to compare with.
|
-
返回
-
Returns true if identical.
◆
CheckIdent()
[2/2]
Checks against the current identifier.
-
参数
-
[in]
|
cmp
|
String
to compare with.
|
-
返回
-
Returns true if identical.
◆
GetLine()
Returns the current line number within the file.