C# Класс idTech4.Text.idLexer

Lexicographical parser.
A number directly following the escape character '\' in a string is assumed to be in decimal format instead of octal. Binary numbers of the form 0b.. or 0B.. can also be used.
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
DefaultPunctuation idTech4.Text.LexerPunctuation[]

Открытые методы

Метод Описание
CheckTokenString ( string str ) : bool

Checks if the next token matches the given string.

CheckTokenType ( TokenType type, TokenSubType subType ) : idToken

Reads the token when a token with the given type is available.

Error ( string format ) : void
ExpectAnyToken ( ) : idToken
ExpectTokenString ( string str ) : bool
ExpectTokenType ( TokenType type, TokenSubType subType ) : idToken
GetPunctuationFromID ( TokenSubType id ) : string
LoadFile ( string fileName, bool osPath = false ) : bool
LoadMemory ( string text, string name ) : bool

Load a script from the given memory.

LoadMemory ( string text, string name, int startLine ) : bool

Load a script from the given memory and a specified line offset, so source strings extracted from a file can still refer to proper line numbers in the file.

Parse1DMatrix ( int elementCount ) : float[]
Parse2DMatrix ( int y, int x ) : ].float[
ParseBool ( ) : bool

Parses a bool.

ParseFloat ( ) : float

Parses a floating point number.

ParseFloat ( bool &errorFlag ) : float

Parses a floating point number.

If errorFlag is NULL, a non-numeric token will issue an Error(). If it isn't NULL, it will issue a Warning() and set *errorFlag = true.

ParseInt ( ) : int

Parses an int.

ParseRestOfLine ( ) : string
ReadToken ( ) : idToken

Reads the next token.

ReadTokenOnLine ( ) : idToken

Read a token only if on the same line.

SkipBracedSection ( ) : bool

Skips until a matching close brace is found.

SkipBracedSection ( bool parseFirstBrace ) : bool

Skips until a matching close brace is found.

SkipRestOfLine ( ) : bool

Skip the rest of the current line.

SkipUntilString ( string str ) : bool
Warning ( string format ) : void
idLexer ( ) : System
idLexer ( LexerOptions options ) : System

Приватные методы

Метод Описание
CheckString ( string str ) : bool
GetBufferCharacter ( int position ) : char
ParseFloat ( bool &errorFlag, bool useErrorFlag ) : float
ReadEscapeCharacter ( char &escapeCharacter ) : bool

Reads two strings with only a white space between them as one string.

ReadName ( idToken token ) : bool
ReadNumber ( idToken token ) : bool
ReadPunctuation ( idToken token ) : bool
ReadString ( idToken token, char quote ) : bool
ReadWhiteSpace ( ) : bool

Reads spaces, tabs, C-like comments, etc.

When a newline character is found the scripts line counter is increased.

Описание методов

CheckTokenString() публичный Метод

Checks if the next token matches the given string.
public CheckTokenString ( string str ) : bool
str string
Результат bool

CheckTokenType() публичный Метод

Reads the token when a token with the given type is available.
public CheckTokenType ( TokenType type, TokenSubType subType ) : idToken
type TokenType
subType TokenSubType
Результат idToken

Error() публичный Метод

public Error ( string format ) : void
format string
Результат void

ExpectAnyToken() публичный Метод

public ExpectAnyToken ( ) : idToken
Результат idToken

ExpectTokenString() публичный Метод

public ExpectTokenString ( string str ) : bool
str string
Результат bool

ExpectTokenType() публичный Метод

public ExpectTokenType ( TokenType type, TokenSubType subType ) : idToken
type TokenType
subType TokenSubType
Результат idToken

GetPunctuationFromID() публичный Метод

public GetPunctuationFromID ( TokenSubType id ) : string
id TokenSubType
Результат string

LoadFile() публичный Метод

public LoadFile ( string fileName, bool osPath = false ) : bool
fileName string
osPath bool
Результат bool

LoadMemory() публичный Метод

Load a script from the given memory.
public LoadMemory ( string text, string name ) : bool
text string
name string
Результат bool

LoadMemory() публичный Метод

Load a script from the given memory and a specified line offset, so source strings extracted from a file can still refer to proper line numbers in the file.
public LoadMemory ( string text, string name, int startLine ) : bool
text string
name string
startLine int
Результат bool

Parse1DMatrix() публичный Метод

public Parse1DMatrix ( int elementCount ) : float[]
elementCount int
Результат float[]

Parse2DMatrix() публичный Метод

public Parse2DMatrix ( int y, int x ) : ].float[
y int
x int
Результат ].float[

ParseBool() публичный Метод

Parses a bool.
public ParseBool ( ) : bool
Результат bool

ParseFloat() публичный Метод

Parses a floating point number.
public ParseFloat ( ) : float
Результат float

ParseFloat() публичный Метод

Parses a floating point number.
If errorFlag is NULL, a non-numeric token will issue an Error(). If it isn't NULL, it will issue a Warning() and set *errorFlag = true.
public ParseFloat ( bool &errorFlag ) : float
errorFlag bool
Результат float

ParseInt() публичный Метод

Parses an int.
public ParseInt ( ) : int
Результат int

ParseRestOfLine() публичный Метод

public ParseRestOfLine ( ) : string
Результат string

ReadToken() публичный Метод

Reads the next token.
public ReadToken ( ) : idToken
Результат idToken

ReadTokenOnLine() публичный Метод

Read a token only if on the same line.
public ReadTokenOnLine ( ) : idToken
Результат idToken

SkipBracedSection() публичный Метод

Skips until a matching close brace is found.
public SkipBracedSection ( ) : bool
Результат bool

SkipBracedSection() публичный Метод

Skips until a matching close brace is found.
public SkipBracedSection ( bool parseFirstBrace ) : bool
parseFirstBrace bool
Результат bool

SkipRestOfLine() публичный Метод

Skip the rest of the current line.
public SkipRestOfLine ( ) : bool
Результат bool

SkipUntilString() публичный Метод

public SkipUntilString ( string str ) : bool
str string
Результат bool

Warning() публичный Метод

public Warning ( string format ) : void
format string
Результат void

idLexer() публичный Метод

public idLexer ( ) : System
Результат System

idLexer() публичный Метод

public idLexer ( LexerOptions options ) : System
options LexerOptions
Результат System

Описание свойств

DefaultPunctuation публичное статическое свойство

public static LexerPunctuation[],idTech4.Text DefaultPunctuation
Результат idTech4.Text.LexerPunctuation[]