C# Class YAMP.ParserExtensions

Useful extensions for the Parser class.
Show file Open project: FlorianRappl/YAMP

Public Methods

Method Description
AddCustomConstant ( this parser, String name, Double constant ) : void

Adds a custom constant to the parser (to the primary context).

AddCustomConstant ( this parser, String name, Value constant ) : void

Adds a custom constant to the parser (to the primary context).

AddCustomFunction ( this parser, String name, FunctionDelegate f ) : void

Adds a custom function to be used by the parser (to the primary context).

AddVariable ( this parser, String name, Value value ) : void

Adds a variable to be used by the parser (to the primary context).

Evaluate ( this parser, String input ) : Value

Execute the evaluation of this parser instance without any external symbols.

Evaluate ( this parser, String input, Object values ) : Value

Execute the evaluation of this parser instance with external symbols.

LoadPlugin ( this parser, Assembly assembly ) : System.Guid

Loads an external library (assembly) that uses IFunction, Operator, ..., into the primary context.

RemoveCustomConstant ( this parser, String name ) : void

Removes a custom constant (to the primary context).

RemoveCustomFunction ( this parser, String name ) : void

Removes a custom function (to the primary context).

RemoveVariable ( this parser, String name ) : void

Removes a variable from the workspace (to the primary context).

RenameConstant ( this parser, String oldName, String newName ) : void

Renames an existing constant (custom or defined).

RenameFunction ( this parser, String oldName, String newName ) : void

Renames an existing function (custom or defined).

UnloadPlugin ( this parser, System.Guid pluginId ) : void

Unloads a previously loaded plugin.

Method Details

AddCustomConstant() public static method

Adds a custom constant to the parser (to the primary context).
public static AddCustomConstant ( this parser, String name, Double constant ) : void
parser this The parser to extend.
name String /// The name of the symbol corresponding to the constant. ///
constant Double /// The value of the constant. ///
return void

AddCustomConstant() public static method

Adds a custom constant to the parser (to the primary context).
public static AddCustomConstant ( this parser, String name, Value constant ) : void
parser this The parser to extend.
name String /// The name of the symbol corresponding to the constant. ///
constant Value /// The value of the constant. ///
return void

AddCustomFunction() public static method

Adds a custom function to be used by the parser (to the primary context).
public static AddCustomFunction ( this parser, String name, FunctionDelegate f ) : void
parser this The parser to extend.
name String /// The name of the symbol corresponding to the function that should be added. ///
f FunctionDelegate /// The function that fulfills the signature Value f(Value v). ///
return void

AddVariable() public static method

Adds a variable to be used by the parser (to the primary context).
public static AddVariable ( this parser, String name, Value value ) : void
parser this The parser to extend.
name String /// The name of the symbol corresponding to the variable that should be added. ///
value Value /// The value of the variable. ///
return void

Evaluate() public static method

Execute the evaluation of this parser instance without any external symbols.
public static Evaluate ( this parser, String input ) : Value
parser this The parser to extend.
input String The input to evaluate.
return Value

Evaluate() public static method

Execute the evaluation of this parser instance with external symbols.
public static Evaluate ( this parser, String input, Object values ) : Value
parser this The parser to extend.
input String The input to evaluate.
values Object /// The values in an anonymous object - containing name - value pairs. ///
return Value

LoadPlugin() public static method

Loads an external library (assembly) that uses IFunction, Operator, ..., into the primary context.
public static LoadPlugin ( this parser, Assembly assembly ) : System.Guid
parser this The parser to extend.
assembly System.Reflection.Assembly /// The assembly to load as a plugin. ///
return System.Guid

RemoveCustomConstant() public static method

Removes a custom constant (to the primary context).
public static RemoveCustomConstant ( this parser, String name ) : void
parser this The parser to extend.
name String /// The name of the symbol corresponding to the constant that should be removed. ///
return void

RemoveCustomFunction() public static method

Removes a custom function (to the primary context).
public static RemoveCustomFunction ( this parser, String name ) : void
parser this The parser to extend.
name String /// The name of the symbol corresponding to the function that should be removed. ///
return void

RemoveVariable() public static method

Removes a variable from the workspace (to the primary context).
public static RemoveVariable ( this parser, String name ) : void
parser this The parser to extend.
name String /// The name of the symbol corresponding to the variable that should be removed. ///
return void

RenameConstant() public static method

Renames an existing constant (custom or defined).
public static RenameConstant ( this parser, String oldName, String newName ) : void
parser this The parser to extend.
oldName String The old name of the constant.
newName String The new name for the constant.
return void

RenameFunction() public static method

Renames an existing function (custom or defined).
public static RenameFunction ( this parser, String oldName, String newName ) : void
parser this The parser to extend.
oldName String The old name of the function.
newName String The new name for the function.
return void

UnloadPlugin() public static method

Unloads a previously loaded plugin.
public static UnloadPlugin ( this parser, System.Guid pluginId ) : void
parser this The parser to extend.
pluginId System.Guid The ID for the assembly to unload.
return void