C# Класс BasicCommandHandlers.CommandParser

Define all necessary operations for a string parser.
Показать файл Открыть проект Примеры использования класса

Private Properties

Свойство Тип Описание
AutoTest bool
CheckIdentifier void
CheckString void
CkeckNotIdentifier void
Forward void
ParseAll void
Peek char
Read char

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

Метод Описание
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.

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

Метод Описание
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.

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

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

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.
Результат System

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

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.
Результат System

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

Get the next token and determine its value.
public GetNextToken ( ) : Token
Результат Token

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

Determines whether the current token is an identifier and returns it.
public IsIdentifier ( string &identifier ) : bool
identifier string Out : the identifier value.
Результат bool

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

Determine wether the current togen is an IsolatedChar and return it.
public IsIsolatedChar ( char &c ) : bool
c char Out : the IsolatedChar value.
Результат bool

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

Determine wether the current token is a number and return it.
public IsNumber ( double &numValue ) : bool
numValue double Out : the number value.
Результат bool

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

Determine wether the current token is a string and return it.
public IsString ( string &s ) : bool
s string Out : the string value.
Результат bool

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

Determine wether a token matches with the current one.
public Match ( Token t ) : bool
t Token The searched token.
Результат bool

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

Determine wether a string is the wanted identifier.
public MatchIdentifier ( string identifier ) : bool
identifier string The wanted identifier.
Результат bool

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

Determine wether a char is the wanted IsolatedChar.
public MatchIsolatedChar ( char c ) : bool
c char The char to test
Результат bool