C# Class BasicCommandHandlers.CommandParser

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

Private Properties

Property Type Description
AutoTest bool
CheckIdentifier void
CheckString void
CkeckNotIdentifier void
Forward void
ParseAll void
Peek char
Read char

Public Methods

Method 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

Method 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 method

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.
return System

CommandParser() public method

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.
return System

GetNextToken() public method

Get the next token and determine its value.
public GetNextToken ( ) : Token
return Token

IsIdentifier() public method

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

IsIsolatedChar() public method

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

IsNumber() public method

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

IsString() public method

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

Match() public method

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

MatchIdentifier() public method

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

MatchIsolatedChar() public method

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