C# Class BasicCommandHandlers.CommandParser

Define all necessary operations for a string parser.
Afficher le fichier Open project: Invenietis/ck-certified Class Usage Examples

Private Properties

Свойство Type Description
AutoTest bool
CheckIdentifier void
CheckString void
CkeckNotIdentifier void
Forward void
ParseAll void
Peek char
Read char

Méthodes publiques

Méthode Description
CommandParser ( string s ) : System

Initializes a new instance of the CommandParser class. Create a parser object from a string. It initialize the parsing at the first character of the string.

CommandParser ( string s, int startIndex ) : System

Initializes a new instance of the CommandParser class. Create a parser object from a string. It initialize the parsing at the index selected by the user.

GetNextToken ( ) : Token

Get the next token and determine its value.

IsIdentifier ( string &identifier ) : bool

Determines whether the current token is an identifier and returns it.

IsIsolatedChar ( char &c ) : bool

Determine wether the current togen is an IsolatedChar and return it.

IsNumber ( double &numValue ) : bool

Determine wether the current token is a number and return it.

IsString ( string &s ) : bool

Determine wether the current token is a string and return it.

Match ( Token t ) : bool

Determine wether a token matches with the current one.

MatchIdentifier ( string identifier ) : bool

Determine wether a string is the wanted identifier.

MatchIsolatedChar ( char c ) : bool

Determine wether a char is the wanted IsolatedChar.

Private Methods

Méthode Description
AutoTest ( ) : bool
CheckIdentifier ( string s, int idPos, string identifier ) : void
CheckString ( string s, int idPos, string strVal ) : void
CkeckNotIdentifier ( string s, int idNotPos ) : void
Forward ( ) : void

Reach the next character.

ParseAll ( string s ) : void
Peek ( ) : char

Peek the current character in the string to parse.

Read ( ) : char

Peek the current character and go to the next.

Method Details

CommandParser() public méthode

Initializes a new instance of the CommandParser class. Create a parser object from a string. It initialize the parsing at the first character of the string.
public CommandParser ( string s ) : System
s string The string to parse.
Résultat System

CommandParser() public méthode

Initializes a new instance of the CommandParser class. Create a parser object from a string. It initialize the parsing at the index selected by the user.
public CommandParser ( string s, int startIndex ) : System
s string The string to parse.
startIndex int Index of the first character for parsing.
Résultat System

GetNextToken() public méthode

Get the next token and determine its value.
public GetNextToken ( ) : Token
Résultat Token

IsIdentifier() public méthode

Determines whether the current token is an identifier and returns it.
public IsIdentifier ( string &identifier ) : bool
identifier string Out : the identifier value.
Résultat bool

IsIsolatedChar() public méthode

Determine wether the current togen is an IsolatedChar and return it.
public IsIsolatedChar ( char &c ) : bool
c char Out : the IsolatedChar value.
Résultat bool

IsNumber() public méthode

Determine wether the current token is a number and return it.
public IsNumber ( double &numValue ) : bool
numValue double Out : the number value.
Résultat bool

IsString() public méthode

Determine wether the current token is a string and return it.
public IsString ( string &s ) : bool
s string Out : the string value.
Résultat bool

Match() public méthode

Determine wether a token matches with the current one.
public Match ( Token t ) : bool
t Token The searched token.
Résultat bool

MatchIdentifier() public méthode

Determine wether a string is the wanted identifier.
public MatchIdentifier ( string identifier ) : bool
identifier string The wanted identifier.
Résultat bool

MatchIsolatedChar() public méthode

Determine wether a char is the wanted IsolatedChar.
public MatchIsolatedChar ( char c ) : bool
c char The char to test
Résultat bool