C# Class BitOrchestra.Parser

Contains parser-related functions.
Show file Open project: dzamkov/Bit-Orchestra

Public Properties

Property Type Description
Parameter string
Resolution string
Result string

Public Methods

Method Description
AcceptAssignment ( Expression>.Dictionary Variables, string Text, int &Index, string &Name, Expression &Value, int &ErrorIndex ) : bool

Tries parsing an assignment.

AcceptComment ( string Text, int &Index, bool &Multiline ) : bool

Tries parsing a comment in the given text.

AcceptExpression ( Expression>.Dictionary Variables, string Text, int &Index, Expression &Expression, int &ErrorIndex ) : bool

Tries parsing an expression in the given text.

AcceptExtendedWhitespace ( string Text, int &Index ) : bool

Tries parsing extended whitespace (whitespace, comments, newlines) in the given text.

AcceptInteger ( string Text, int &Index, int &Value, int &ErrorIndex ) : bool

Tries parsing an integer value given in binary, decimal or hexadecimal.

AcceptLiteral ( string Text, int &Index, Expression &Term, int &ErrorIndex ) : bool

Tries parsing a literal term in the given text.

AcceptNewline ( string Text, int &Index ) : bool

Tries parsing a newline in the given text.

AcceptOperator ( string Text, int &Index, Operator &Operator ) : bool

Tries parsing an operator in the given text.

AcceptOption ( string Text, int &Index, SoundOptions Options, int &ErrorIndex ) : bool

Tries parsing an option and applying it to the given sound options structure.

AcceptOption ( string Text, int &Index, string &Name, int &Value, int &ErrorIndex ) : bool

Tries parsing an option.

AcceptProgram ( string Text, int &Index, Expression>.Dictionary &Variables, SoundOptions &Options, int &ErrorIndex ) : void

Parses a program in the given text.

AcceptString ( string Target, string Text, int &Index ) : bool

Tries parsing the target string in the given text.

AcceptTerm ( Expression>.Dictionary Variables, string Text, int &Index, Expression &Term, int &ErrorIndex ) : bool

Tries parsing a term in the given text.

AcceptWhitespace ( string Text, int &Index ) : bool

Tries parsing whitespace (tabs and spaces) in the given text.

AcceptWord ( string Text, int &Index, string &Word ) : bool

Tries parsing a word in the given text.

IsDecimalDigit ( char Char, int &Value ) : bool

Determines wether the given character is a decimal digit, if so, returns its value.

IsHexadecimalDigit ( char Char, int &Value ) : bool

Determines wether the given character is a hexadecimal digit, if so, returns its value.

IsWordChar ( char Char ) : bool

Determines wether the given character is valid in a word. Note that digits are not valid as the first character in a word.

Parse ( string Text, Expression &Expression, SoundOptions &Options, int &ErrorIndex ) : bool

Parses the given text and either returns true with an expression and sound options, or false with an error index.

Parse ( string Text, int TargetIndex, int TargetLength, Expression &Expression, SoundOptions &Options, int &ErrorIndex ) : bool

Parses the given text (or as much as possible of it) and returns the expression for the specified target string, or false with an error index.

Method Details

AcceptAssignment() public static method

Tries parsing an assignment.
public static AcceptAssignment ( Expression>.Dictionary Variables, string Text, int &Index, string &Name, Expression &Value, int &ErrorIndex ) : bool
Variables Expression>.Dictionary
Text string
Index int
Name string
Value Expression
ErrorIndex int
return bool

AcceptComment() public static method

Tries parsing a comment in the given text.
public static AcceptComment ( string Text, int &Index, bool &Multiline ) : bool
Text string
Index int
Multiline bool
return bool

AcceptExpression() public static method

Tries parsing an expression in the given text.
public static AcceptExpression ( Expression>.Dictionary Variables, string Text, int &Index, Expression &Expression, int &ErrorIndex ) : bool
Variables Expression>.Dictionary
Text string
Index int
Expression Expression
ErrorIndex int
return bool

AcceptExtendedWhitespace() public static method

Tries parsing extended whitespace (whitespace, comments, newlines) in the given text.
public static AcceptExtendedWhitespace ( string Text, int &Index ) : bool
Text string
Index int
return bool

AcceptInteger() public static method

Tries parsing an integer value given in binary, decimal or hexadecimal.
public static AcceptInteger ( string Text, int &Index, int &Value, int &ErrorIndex ) : bool
Text string
Index int
Value int
ErrorIndex int
return bool

AcceptLiteral() public static method

Tries parsing a literal term in the given text.
public static AcceptLiteral ( string Text, int &Index, Expression &Term, int &ErrorIndex ) : bool
Text string
Index int
Term Expression
ErrorIndex int
return bool

AcceptNewline() public static method

Tries parsing a newline in the given text.
public static AcceptNewline ( string Text, int &Index ) : bool
Text string
Index int
return bool

AcceptOperator() public static method

Tries parsing an operator in the given text.
public static AcceptOperator ( string Text, int &Index, Operator &Operator ) : bool
Text string
Index int
Operator Operator
return bool

AcceptOption() public static method

Tries parsing an option and applying it to the given sound options structure.
public static AcceptOption ( string Text, int &Index, SoundOptions Options, int &ErrorIndex ) : bool
Text string
Index int
Options SoundOptions
ErrorIndex int
return bool

AcceptOption() public static method

Tries parsing an option.
public static AcceptOption ( string Text, int &Index, string &Name, int &Value, int &ErrorIndex ) : bool
Text string
Index int
Name string
Value int
ErrorIndex int
return bool

AcceptProgram() public static method

Parses a program in the given text.
public static AcceptProgram ( string Text, int &Index, Expression>.Dictionary &Variables, SoundOptions &Options, int &ErrorIndex ) : void
Text string
Index int
Variables Expression>.Dictionary
Options SoundOptions
ErrorIndex int
return void

AcceptString() public static method

Tries parsing the target string in the given text.
public static AcceptString ( string Target, string Text, int &Index ) : bool
Target string
Text string
Index int
return bool

AcceptTerm() public static method

Tries parsing a term in the given text.
public static AcceptTerm ( Expression>.Dictionary Variables, string Text, int &Index, Expression &Term, int &ErrorIndex ) : bool
Variables Expression>.Dictionary
Text string
Index int
Term Expression
ErrorIndex int
return bool

AcceptWhitespace() public static method

Tries parsing whitespace (tabs and spaces) in the given text.
public static AcceptWhitespace ( string Text, int &Index ) : bool
Text string
Index int
return bool

AcceptWord() public static method

Tries parsing a word in the given text.
public static AcceptWord ( string Text, int &Index, string &Word ) : bool
Text string
Index int
Word string
return bool

IsDecimalDigit() public static method

Determines wether the given character is a decimal digit, if so, returns its value.
public static IsDecimalDigit ( char Char, int &Value ) : bool
Char char
Value int
return bool

IsHexadecimalDigit() public static method

Determines wether the given character is a hexadecimal digit, if so, returns its value.
public static IsHexadecimalDigit ( char Char, int &Value ) : bool
Char char
Value int
return bool

IsWordChar() public static method

Determines wether the given character is valid in a word. Note that digits are not valid as the first character in a word.
public static IsWordChar ( char Char ) : bool
Char char
return bool

Parse() public static method

Parses the given text and either returns true with an expression and sound options, or false with an error index.
public static Parse ( string Text, Expression &Expression, SoundOptions &Options, int &ErrorIndex ) : bool
Text string
Expression Expression
Options SoundOptions
ErrorIndex int
return bool

Parse() public static method

Parses the given text (or as much as possible of it) and returns the expression for the specified target string, or false with an error index.
public static Parse ( string Text, int TargetIndex, int TargetLength, Expression &Expression, SoundOptions &Options, int &ErrorIndex ) : bool
Text string
TargetIndex int
TargetLength int
Expression Expression
Options SoundOptions
ErrorIndex int
return bool

Property Details

Parameter public static property

The variable for the parameter of an expression.
public static string Parameter
return string

Resolution public static property

The variable for the resolution of a running expression.
public static string Resolution
return string

Result public static property

The variable for the result of an expression.
public static string Result
return string