2using System.Threading.Tasks;
16 private readonly
string definition;
19 private readonly
bool isExpression;
20 private bool first =
true;
31 this.isExpression = this.definition.StartsWith(
"{") && this.definition.EndsWith(
"}");
52 public bool IsEmpty =>
string.IsNullOrEmpty(this.definition);
70 if (this.isExpression)
72 string s = this.definition.Substring(1, this.definition.Length - 2);
75 throw new UnauthorizedAccessException(
"Expression not permitted: " + Prohibited?.SubExpression);
77 this.expression = Exp;
80 this.constant = this.
ParseValue(this.definition);
85 if (this.isExpression)
90 Variables.ContextVariables = this.node.StateMachine;
96 Variables.ContextVariables = Bak;
100 return this.constant;
static bool CheckExpressionSafe(Expression Expression, out ScriptNode Prohibited)
Checks if an expression is safe to execute (if it comes from an external source).
Class managing a script expression.
async Task< object > EvaluateAsync(Variables Variables)
Evaluates the expression, using the variables provided in the Variables collection....
Base class for all nodes in a parsed script tree.
IContextVariables ContextVariables
Variables available during the current context.
Abstract base class for scriptable attributes.
bool IsEmpty
If the definition is empty.
abstract T ParseValue(string s)
Parses a string representation of a value.
bool IsExpression
If the attribute value is an expression.
async Task< T > Evaluate(Variables Variables)
Evaluates the attribute
bool IsConstant
If the attribute value is a constant.
string Definition
Attribute definition
ScriptableAttribute(string Definition, StateMachineNode Node)
Abstract base class for scriptable attributes.
Abstract base class for State-Machine nodes.
Variables available in a specific context.