Class Parser
An immutable implementation of the IParser interface.
Inheritance
System.Object
Parser
Assembly: Albatross.Expression.dll
Syntax
public class Parser : IParser
Constructors
Parser(IEnumerable<IToken>, IVariableToken, IStringLiteralToken)
Declaration
public Parser(IEnumerable<IToken> operations, IVariableToken variableToken, IStringLiteralToken stringLiteralToken)
Parameters
Properties
InfixOperationTokens
Declaration
public IEnumerable<InfixOperationToken> InfixOperationTokens { get; }
Property Value
PrefixOperationTokens
Declaration
public IEnumerable<PrefixOperationToken> PrefixOperationTokens { get; }
Property Value
Methods
BuildStack(Queue<IToken>)
Declaration
public Stack<IToken> BuildStack(Queue<IToken> queue)
Parameters
Type |
Name |
Description |
System.Collections.Generic.Queue<IToken> |
queue |
|
Returns
Type |
Description |
System.Collections.Generic.Stack<IToken> |
|
CreateTree(Stack<IToken>)
Declaration
public IToken CreateTree(Stack<IToken> postfix)
Parameters
Type |
Name |
Description |
System.Collections.Generic.Stack<IToken> |
postfix |
|
Returns
Eval(IToken, Func<String, Object>)
Declaration
public object Eval(IToken token, Func<string, object> context)
Parameters
Type |
Name |
Description |
IToken |
token |
|
System.Func<System.String, System.Object> |
context |
|
Returns
Type |
Description |
System.Object |
|
EvalText(IToken, String)
Declaration
public string EvalText(IToken token, string format)
Parameters
Type |
Name |
Description |
IToken |
token |
|
System.String |
format |
|
Returns
Type |
Description |
System.String |
|
IsValidExpression(String)
Declaration
public bool IsValidExpression(string exp)
Parameters
Type |
Name |
Description |
System.String |
exp |
|
Returns
Type |
Description |
System.Boolean |
|
Reverse<T>(Stack<T>)
Declaration
public static Stack<T> Reverse<T>(Stack<T> src)
Parameters
Type |
Name |
Description |
System.Collections.Generic.Stack<T> |
src |
|
Returns
Type |
Description |
System.Collections.Generic.Stack<T> |
|
Type Parameters
StringLiteralToken()
Declaration
public IStringLiteralToken StringLiteralToken()
Returns
Tokenize(String)
Declaration
public Queue<IToken> Tokenize(string expression)
Parameters
Type |
Name |
Description |
System.String |
expression |
|
Returns
Type |
Description |
System.Collections.Generic.Queue<IToken> |
|
VariableToken()
Declaration
public IToken VariableToken()
Returns
Implements
Extension Methods