C# Class 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.
Afficher le fichier Open project: iainmckay/idtech4.net Class Usage Examples

Méthodes publiques

Свойство Type Description
DefaultPunctuation idTech4.Text.LexerPunctuation[]

Méthodes publiques

Méthode Description
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

Private Methods

Méthode Description
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.

Method Details

CheckTokenString() public méthode

Checks if the next token matches the given string.
public CheckTokenString ( string str ) : bool
str string
Résultat bool

CheckTokenType() public méthode

Reads the token when a token with the given type is available.
public CheckTokenType ( TokenType type, TokenSubType subType ) : idToken
type TokenType
subType TokenSubType
Résultat idToken

Error() public méthode

public Error ( string format ) : void
format string
Résultat void

ExpectAnyToken() public méthode

public ExpectAnyToken ( ) : idToken
Résultat idToken

ExpectTokenString() public méthode

public ExpectTokenString ( string str ) : bool
str string
Résultat bool

ExpectTokenType() public méthode

public ExpectTokenType ( TokenType type, TokenSubType subType ) : idToken
type TokenType
subType TokenSubType
Résultat idToken

GetPunctuationFromID() public méthode

public GetPunctuationFromID ( TokenSubType id ) : string
id TokenSubType
Résultat string

LoadFile() public méthode

public LoadFile ( string fileName, bool osPath = false ) : bool
fileName string
osPath bool
Résultat bool

LoadMemory() public méthode

Load a script from the given memory.
public LoadMemory ( string text, string name ) : bool
text string
name string
Résultat bool

LoadMemory() public méthode

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
Résultat bool

Parse1DMatrix() public méthode

public Parse1DMatrix ( int elementCount ) : float[]
elementCount int
Résultat float[]

Parse2DMatrix() public méthode

public Parse2DMatrix ( int y, int x ) : ].float[
y int
x int
Résultat ].float[

ParseBool() public méthode

Parses a bool.
public ParseBool ( ) : bool
Résultat bool

ParseFloat() public méthode

Parses a floating point number.
public ParseFloat ( ) : float
Résultat float

ParseFloat() public méthode

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
Résultat float

ParseInt() public méthode

Parses an int.
public ParseInt ( ) : int
Résultat int

ParseRestOfLine() public méthode

public ParseRestOfLine ( ) : string
Résultat string

ReadToken() public méthode

Reads the next token.
public ReadToken ( ) : idToken
Résultat idToken

ReadTokenOnLine() public méthode

Read a token only if on the same line.
public ReadTokenOnLine ( ) : idToken
Résultat idToken

SkipBracedSection() public méthode

Skips until a matching close brace is found.
public SkipBracedSection ( ) : bool
Résultat bool

SkipBracedSection() public méthode

Skips until a matching close brace is found.
public SkipBracedSection ( bool parseFirstBrace ) : bool
parseFirstBrace bool
Résultat bool

SkipRestOfLine() public méthode

Skip the rest of the current line.
public SkipRestOfLine ( ) : bool
Résultat bool

SkipUntilString() public méthode

public SkipUntilString ( string str ) : bool
str string
Résultat bool

Warning() public méthode

public Warning ( string format ) : void
format string
Résultat void

idLexer() public méthode

public idLexer ( ) : System
Résultat System

idLexer() public méthode

public idLexer ( LexerOptions options ) : System
options LexerOptions
Résultat System

Property Details

DefaultPunctuation public_oe static_oe property

public static LexerPunctuation[],idTech4.Text DefaultPunctuation
Résultat idTech4.Text.LexerPunctuation[]