Version 3.3.1.2

ExpressionUtility class

Namespace: Sirenix.Utilities.Editor.Expressions
Assembly: Sirenix.Utilities.Editor
public static class ExpressionUtility
Utility for parsing and emitting expression delegates.
Inheritance
  • System.Object
  • ExpressionUtility

Fields

ExpressionCacheClearTimeSeconds
The time that the expression cache waits to clear expressions since the last time they have been used.
public static float ExpressionCacheClearTimeSeconds

Methods

GetASTPrettyPrint(String)
public static string GetASTPrettyPrint(string expression)
Parameters
System.String expression

Returns
System.String

ParseAction(String, Type, out String, Boolean)
Parses an expression and emits an ExpressionAction method.
public static ExpressionAction ParseAction(string expression, Type contextType, out string errorMessage, bool richTextError = true)
Parameters
System.String expression

The expression to parse.

System.Type contextType

The context type for the execution of the expression.

System.String errorMessage

Output for any errors that may occur.

System.Boolean richTextError

If true then error message will be formatted with color tags. Otherwise, the error message will be formatted with text only.

Returns
Sirenix.Utilities.Editor.Expressions.ExpressionAction

Returns the emitted ExpressionAction if the expression is compiled successfully. Otherwise, null.

ParseAction<T1>(String, Boolean, Type, out String, Boolean)
Parses an expression and emits an ExpressionAction method.
public static ExpressionAction<T1> ParseAction<T1>(string expression, bool isStatic, Type contextType, out string errorMessage, bool richTextError = true)
Parameters
System.String expression

The expression to parse.

System.Boolean isStatic

Indicates if the expression should be static instead of instanced.

System.Type contextType

The context type for the execution of the expression.

System.String errorMessage

Output for any errors that may occur.

System.Boolean richTextError

If true then error message will be formatted with color tags. Otherwise, the error message will be formatted with text only.

Returns
Sirenix.Utilities.Editor.Expressions.ExpressionAction<T1>

Returns the emitted ExpressionAction if the expression is compiled successfully. Otherwise, null.

Type Parameters
T1

ParseAction<T1, T2>(String, Boolean, Type, out String, Boolean)
Parses an expression and emits an ExpressionAction method.
public static ExpressionAction<T1, T2> ParseAction<T1, T2>(string expression, bool isStatic, Type contextType, out string errorMessage, bool richTextError = true)
Parameters
System.String expression

The expression to parse.

System.Boolean isStatic

Indicates if the expression should be static instead of instanced.

System.Type contextType

The context type for the execution of the expression.

System.String errorMessage

Output for any errors that may occur.

System.Boolean richTextError

If true then error message will be formatted with color tags. Otherwise, the error message will be formatted with text only.

Returns
Sirenix.Utilities.Editor.Expressions.ExpressionAction<T1, T2>

Returns the emitted ExpressionAction if the expression is compiled successfully. Otherwise, null.

Type Parameters
T1

T2

ParseAction<T1, T2, T3>(String, Boolean, Type, out String, Boolean)
Parses an expression and emits an ExpressionAction method.
public static ExpressionAction<T1, T2, T3> ParseAction<T1, T2, T3>(string expression, bool isStatic, Type contextType, out string errorMessage, bool richTextError = true)
Parameters
System.String expression

The expression to parse.

System.Boolean isStatic

Indicates if the expression should be static instead of instanced.

System.Type contextType

The context type for the execution of the expression.

System.String errorMessage

Output for any errors that may occur.

System.Boolean richTextError

If true then error message will be formatted with color tags. Otherwise, the error message will be formatted with text only.

Returns
Sirenix.Utilities.Editor.Expressions.ExpressionAction<T1, T2, T3>

Returns the emitted ExpressionAction if the expression is compiled successfully. Otherwise, null.

Type Parameters
T1

T2

T3

ParseAction<T1, T2, T3, T4>(String, Boolean, Type, out String, Boolean)
Parses an expression and emits an ExpressionAction method.
public static ExpressionAction<T1, T2, T3, T4> ParseAction<T1, T2, T3, T4>(string expression, bool isStatic, Type contextType, out string errorMessage, bool richTextError = true)
Parameters
System.String expression

The expression to parse.

System.Boolean isStatic

Indicates if the expression should be static instead of instanced.

System.Type contextType

The context type for the execution of the expression.

System.String errorMessage

Output for any errors that may occur.

System.Boolean richTextError

If true then error message will be formatted with color tags. Otherwise, the error message will be formatted with text only.

Returns
Sirenix.Utilities.Editor.Expressions.ExpressionAction<T1, T2, T3, T4>

Returns the emitted ExpressionAction if the expression is compiled successfully. Otherwise, null.

Type Parameters
T1

T2

T3

T4

ParseAction<T1, T2, T3, T4, T5>(String, Boolean, Type, out String, Boolean)
Parses an expression and emits an ExpressionAction method.
public static ExpressionAction<T1, T2, T3, T4, T5> ParseAction<T1, T2, T3, T4, T5>(string expression, bool isStatic, Type contextType, out string errorMessage, bool richTextError = true)
Parameters
System.String expression

The expression to parse.

System.Boolean isStatic

Indicates if the expression should be static instead of instanced.

System.Type contextType

The context type for the execution of the expression.

System.String errorMessage

Output for any errors that may occur.

System.Boolean richTextError

If true then error message will be formatted with color tags. Otherwise, the error message will be formatted with text only.

Returns
Sirenix.Utilities.Editor.Expressions.ExpressionAction<T1, T2, T3, T4, T5>

Returns the emitted ExpressionAction if the expression is compiled successfully. Otherwise, null.

Type Parameters
T1

T2

T3

T4

T5

ParseAction<T1, T2, T3, T4, T5, T6>(String, Boolean, Type, out String, Boolean)
Parses an expression and emits an ExpressionAction method.
public static ExpressionAction<T1, T2, T3, T4, T5, T6> ParseAction<T1, T2, T3, T4, T5, T6>(string expression, bool isStatic, Type contextType, out string errorMessage, bool richTextError = true)
Parameters
System.String expression

The expression to parse.

System.Boolean isStatic

Indicates if the expression should be static instead of instanced.

System.Type contextType

The context type for the execution of the expression.

System.String errorMessage

Output for any errors that may occur.

System.Boolean richTextError

If true then error message will be formatted with color tags. Otherwise, the error message will be formatted with text only.

Returns
Sirenix.Utilities.Editor.Expressions.ExpressionAction<T1, T2, T3, T4, T5, T6>

Returns the emitted ExpressionAction if the expression is compiled successfully. Otherwise, null.

Type Parameters
T1

T2

T3

T4

T5

T6

ParseAction<T1, T2, T3, T4, T5, T6, T7>(String, Boolean, Type, out String, Boolean)
Parses an expression and emits an ExpressionAction method.
public static ExpressionAction<T1, T2, T3, T4, T5, T6, T7> ParseAction<T1, T2, T3, T4, T5, T6, T7>(string expression, bool isStatic, Type contextType, out string errorMessage, bool richTextError = true)
Parameters
System.String expression

The expression to parse.

System.Boolean isStatic

Indicates if the expression should be static instead of instanced.

System.Type contextType

The context type for the execution of the expression.

System.String errorMessage

Output for any errors that may occur.

System.Boolean richTextError

If true then error message will be formatted with color tags. Otherwise, the error message will be formatted with text only.

Returns
Sirenix.Utilities.Editor.Expressions.ExpressionAction<T1, T2, T3, T4, T5, T6, T7>

Returns the emitted ExpressionAction if the expression is compiled successfully. Otherwise, null.

Type Parameters
T1

T2

T3

T4

T5

T6

T7

ParseAction<T1, T2, T3, T4, T5, T6, T7, T8>(String, Boolean, Type, out String, Boolean)
Parses an expression and emits an ExpressionAction method.
public static ExpressionAction<T1, T2, T3, T4, T5, T6, T7, T8> ParseAction<T1, T2, T3, T4, T5, T6, T7, T8>(string expression, bool isStatic, Type contextType, out string errorMessage, bool richTextError = true)
Parameters
System.String expression

The expression to parse.

System.Boolean isStatic

Indicates if the expression should be static instead of instanced.

System.Type contextType

The context type for the execution of the expression.

System.String errorMessage

Output for any errors that may occur.

System.Boolean richTextError

If true then error message will be formatted with color tags. Otherwise, the error message will be formatted with text only.

Returns
Sirenix.Utilities.Editor.Expressions.ExpressionAction<T1, T2, T3, T4, T5, T6, T7, T8>

Returns the emitted ExpressionAction if the expression is compiled successfully. Otherwise, null.

Type Parameters
T1

T2

T3

T4

T5

T6

T7

T8

ParseAction<T1, T2, T3, T4, T5, T6, T7, T8, T9>(String, Boolean, Type, out String, Boolean)
Parses an expression and emits an ExpressionAction method.
public static ExpressionAction<T1, T2, T3, T4, T5, T6, T7, T8, T9> ParseAction<T1, T2, T3, T4, T5, T6, T7, T8, T9>(string expression, bool isStatic, Type contextType, out string errorMessage, bool richTextError = true)
Parameters
System.String expression

The expression to parse.

System.Boolean isStatic

Indicates if the expression should be static instead of instanced.

System.Type contextType

The context type for the execution of the expression.

System.String errorMessage

Output for any errors that may occur.

System.Boolean richTextError

If true then error message will be formatted with color tags. Otherwise, the error message will be formatted with text only.

Returns
Sirenix.Utilities.Editor.Expressions.ExpressionAction<T1, T2, T3, T4, T5, T6, T7, T8, T9>

Returns the emitted ExpressionAction if the expression is compiled successfully. Otherwise, null.

Type Parameters
T1

T2

T3

T4

T5

T6

T7

T8

T9

ParseExpression(String, EmitContext, out String, Boolean)
Parses an expression and tries to emit a delegate method.
public static Delegate ParseExpression(string expression, EmitContext context, out string errorMessage, bool richTextError = true)
Parameters
System.String expression

The expression to parse.

EmitContext context

The emit context.

System.String errorMessage

Output for any errors that may occur.

System.Boolean richTextError

If true then error message will be formatted with color tags. Otherwise, the error message will be formatted with text only.

Returns
System.Delegate

Returns the emitted delegate if the expression is compiled successfully. Otherwise, null.

ParseExpression(String, EmitContext, Type, out String, Boolean)
Parses an expression and tries to emit a delegate of the specified type.
public static Delegate ParseExpression(string expression, EmitContext context, Type delegateType, out string errorMessage, bool richTextError = true)
Parameters
System.String expression

The expression to parse.

EmitContext context

The emit context.

System.Type delegateType

The type of the delegate to emit.

System.String errorMessage

Output for any errors that may occur.

System.Boolean richTextError

If true then error message will be formatted with color tags. Otherwise, the error message will be formatted with text only.

Returns
System.Delegate

Returns the emitted delegate if the expression is compiled successfully. Otherwise, null.

ParseExpression(String, Boolean, Type, out String, Boolean)
Parses an expression and tries to emit a delegate method.
public static Delegate ParseExpression(string expression, bool isStatic, Type contextType, out string errorMessage, bool richTextError = true)
Parameters
System.String expression

The expression to parse.

System.Boolean isStatic

Indicates if the expression should be static instead of instanced.

System.Type contextType

The context type for the execution of the expression.

System.String errorMessage

Output for any errors that may occur.

System.Boolean richTextError

If true then error message will be formatted with color tags. Otherwise, the error message will be formatted with text only.

Returns
System.Delegate

Returns the emitted delegate if the expression is compiled successfully. Otherwise, null.

ParseExpression(String, Boolean, Type, Type[], out String, Boolean)
Parses an expression and tries to emit a delegate method.
public static Delegate ParseExpression(string expression, bool isStatic, Type contextType, Type[] parameters, out string errorMessage, bool richTextError = true)
Parameters
System.String expression

The expression to parse.

System.Boolean isStatic

Indicates if the expression should be static instead of instanced.

System.Type contextType

The context type for the execution of the expression.

System.Type[] parameters

The parameters of the expression delegate.

System.String errorMessage

Output for any errors that may occur.

System.Boolean richTextError

If true then error message will be formatted with color tags. Otherwise, the error message will be formatted with text only.

Returns
System.Delegate

Returns the emitted delegate if the expression is compiled successfully. Otherwise, null.

ParseExpression(String, Boolean, Type, Type[], String[], out String, Boolean)
Parses an expression and tries to emit a delegate method.
public static Delegate ParseExpression(string expression, bool isStatic, Type contextType, Type[] parameters, string[] parameterNames, out string errorMessage, bool richTextError = true)
Parameters
System.String expression

The expression to parse.

System.Boolean isStatic

Indicates if the expression should be static instead of instanced.

System.Type contextType

The context type for the execution of the expression.

System.Type[] parameters

The parameters of the expression delegate.

System.String[] parameterNames

The names of the expression's parameters, for use with the named parameter syntax.

System.String errorMessage

Output for any errors that may occur.

System.Boolean richTextError

If true then error message will be formatted with color tags. Otherwise, the error message will be formatted with text only.

Returns
System.Delegate

Returns the emitted delegate if the expression is compiled successfully. Otherwise, null.

ParseFunc<TResult>(String, Type, out String, Boolean)
Parses an expression and emits an ExpressionFunc method.
public static ExpressionFunc<TResult> ParseFunc<TResult>(string expression, Type contextType, out string errorMessage, bool richTextError = true)
Parameters
System.String expression

The expression to parse.

System.Type contextType

The context type for the execution of the expression.

System.String errorMessage

Output for any errors that may occur.

System.Boolean richTextError

If true then error message will be formatted with color tags. Otherwise, the error message will be formatted with text only.

Returns
Sirenix.Utilities.Editor.Expressions.ExpressionFunc<TResult>

Returns the emitted ExpressionFunc if the expression is compiled successfully. Otherwise, null.

Type Parameters
TResult

ParseFunc<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>(String, Boolean, Type, out String, Boolean)
Parses an expression and emits an ExpressionFunc method.
public static ExpressionFunc<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult> ParseFunc<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>(string expression, bool isStatic, Type contextType, out string errorMessage, bool richTextError = true)
Parameters
System.String expression

The expression to parse.

System.Boolean isStatic

Indicates if the expression should be static instead of instanced.

System.Type contextType

The context type for the execution of the expression.

System.String errorMessage

Output for any errors that may occur.

System.Boolean richTextError

If true then error message will be formatted with color tags. Otherwise, the error message will be formatted with text only.

Returns
Sirenix.Utilities.Editor.Expressions.ExpressionFunc<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>

Returns the emitted ExpressionFunc if the expression is compiled successfully. Otherwise, null.

Type Parameters
T1

T2

T3

T4

T5

T6

T7

T8

T9

TResult

ParseFunc<T1, TResult>(String, Boolean, Type, out String, Boolean)
Parses an expression and emits an ExpressionFunc method.
public static ExpressionFunc<T1, TResult> ParseFunc<T1, TResult>(string expression, bool isStatic, Type contextType, out string errorMessage, bool richTextError = true)
Parameters
System.String expression

The expression to parse.

System.Boolean isStatic

Indicates if the expression should be static instead of instanced.

System.Type contextType

The context type for the execution of the expression.

System.String errorMessage

Output for any errors that may occur.

System.Boolean richTextError

If true then error message will be formatted with color tags. Otherwise, the error message will be formatted with text only.

Returns
Sirenix.Utilities.Editor.Expressions.ExpressionFunc<T1, TResult>

Returns the emitted ExpressionFunc if the expression is compiled successfully. Otherwise, null.

Type Parameters
T1

TResult

ParseFunc<T1, T2, TResult>(String, Boolean, Type, out String, Boolean)
Parses an expression and emits an ExpressionFunc method.
public static ExpressionFunc<T1, T2, TResult> ParseFunc<T1, T2, TResult>(string expression, bool isStatic, Type contextType, out string errorMessage, bool richTextError = true)
Parameters
System.String expression

The expression to parse.

System.Boolean isStatic

Indicates if the expression should be static instead of instanced.

System.Type contextType

The context type for the execution of the expression.

System.String errorMessage

Output for any errors that may occur.

System.Boolean richTextError

If true then error message will be formatted with color tags. Otherwise, the error message will be formatted with text only.

Returns
Sirenix.Utilities.Editor.Expressions.ExpressionFunc<T1, T2, TResult>

Returns the emitted ExpressionFunc if the expression is compiled successfully. Otherwise, null.

Type Parameters
T1

T2

TResult

ParseFunc<T1, T2, T3, TResult>(String, Boolean, Type, out String, Boolean)
Parses an expression and emits an ExpressionFunc method.
public static ExpressionFunc<T1, T2, T3, TResult> ParseFunc<T1, T2, T3, TResult>(string expression, bool isStatic, Type contextType, out string errorMessage, bool richTextError = true)
Parameters
System.String expression

The expression to parse.

System.Boolean isStatic

Indicates if the expression should be static instead of instanced.

System.Type contextType

The context type for the execution of the expression.

System.String errorMessage

Output for any errors that may occur.

System.Boolean richTextError

If true then error message will be formatted with color tags. Otherwise, the error message will be formatted with text only.

Returns
Sirenix.Utilities.Editor.Expressions.ExpressionFunc<T1, T2, T3, TResult>

Returns the emitted ExpressionFunc if the expression is compiled successfully. Otherwise, null.

Type Parameters
T1

T2

T3

TResult

ParseFunc<T1, T2, T3, T4, TResult>(String, Boolean, Type, out String, Boolean)
Parses an expression and emits an ExpressionFunc method.
public static ExpressionFunc<T1, T2, T3, T4, TResult> ParseFunc<T1, T2, T3, T4, TResult>(string expression, bool isStatic, Type contextType, out string errorMessage, bool richTextError = true)
Parameters
System.String expression

The expression to parse.

System.Boolean isStatic

Indicates if the expression should be static instead of instanced.

System.Type contextType

The context type for the execution of the expression.

System.String errorMessage

Output for any errors that may occur.

System.Boolean richTextError

If true then error message will be formatted with color tags. Otherwise, the error message will be formatted with text only.

Returns
Sirenix.Utilities.Editor.Expressions.ExpressionFunc<T1, T2, T3, T4, TResult>

Returns the emitted ExpressionFunc if the expression is compiled successfully. Otherwise, null.

Type Parameters
T1

T2

T3

T4

TResult

ParseFunc<T1, T2, T3, T4, T5, TResult>(String, Boolean, Type, out String, Boolean)
Parses an expression and emits an ExpressionFunc method.
public static ExpressionFunc<T1, T2, T3, T4, T5, TResult> ParseFunc<T1, T2, T3, T4, T5, TResult>(string expression, bool isStatic, Type contextType, out string errorMessage, bool richTextError = true)
Parameters
System.String expression

The expression to parse.

System.Boolean isStatic

Indicates if the expression should be static instead of instanced.

System.Type contextType

The context type for the execution of the expression.

System.String errorMessage

Output for any errors that may occur.

System.Boolean richTextError

If true then error message will be formatted with color tags. Otherwise, the error message will be formatted with text only.

Returns
Sirenix.Utilities.Editor.Expressions.ExpressionFunc<T1, T2, T3, T4, T5, TResult>

Returns the emitted ExpressionFunc if the expression is compiled successfully. Otherwise, null.

Type Parameters
T1

T2

T3

T4

T5

TResult

ParseFunc<T1, T2, T3, T4, T5, T6, TResult>(String, Boolean, Type, out String, Boolean)
Parses an expression and emits an ExpressionFunc method.
public static ExpressionFunc<T1, T2, T3, T4, T5, T6, TResult> ParseFunc<T1, T2, T3, T4, T5, T6, TResult>(string expression, bool isStatic, Type contextType, out string errorMessage, bool richTextError = true)
Parameters
System.String expression

The expression to parse.

System.Boolean isStatic

Indicates if the expression should be static instead of instanced.

System.Type contextType

The context type for the execution of the expression.

System.String errorMessage

Output for any errors that may occur.

System.Boolean richTextError

If true then error message will be formatted with color tags. Otherwise, the error message will be formatted with text only.

Returns
Sirenix.Utilities.Editor.Expressions.ExpressionFunc<T1, T2, T3, T4, T5, T6, TResult>

Returns the emitted ExpressionFunc if the expression is compiled successfully. Otherwise, null.

Type Parameters
T1

T2

T3

T4

T5

T6

TResult

ParseFunc<T1, T2, T3, T4, T5, T6, T7, TResult>(String, Boolean, Type, out String, Boolean)
Parses an expression and emits an ExpressionFunc method.
public static ExpressionFunc<T1, T2, T3, T4, T5, T6, T7, TResult> ParseFunc<T1, T2, T3, T4, T5, T6, T7, TResult>(string expression, bool isStatic, Type contextType, out string errorMessage, bool richTextError = true)
Parameters
System.String expression

The expression to parse.

System.Boolean isStatic

Indicates if the expression should be static instead of instanced.

System.Type contextType

The context type for the execution of the expression.

System.String errorMessage

Output for any errors that may occur.

System.Boolean richTextError

If true then error message will be formatted with color tags. Otherwise, the error message will be formatted with text only.

Returns
Sirenix.Utilities.Editor.Expressions.ExpressionFunc<T1, T2, T3, T4, T5, T6, T7, TResult>

Returns the emitted ExpressionFunc if the expression is compiled successfully. Otherwise, null.

Type Parameters
T1

T2

T3

T4

T5

T6

T7

TResult

ParseFunc<T1, T2, T3, T4, T5, T6, T7, T8, TResult>(String, Boolean, Type, out String, Boolean)
Parses an expression and emits an ExpressionFunc method.
public static ExpressionFunc<T1, T2, T3, T4, T5, T6, T7, T8, TResult> ParseFunc<T1, T2, T3, T4, T5, T6, T7, T8, TResult>(string expression, bool isStatic, Type contextType, out string errorMessage, bool richTextError = true)
Parameters
System.String expression

The expression to parse.

System.Boolean isStatic

Indicates if the expression should be static instead of instanced.

System.Type contextType

The context type for the execution of the expression.

System.String errorMessage

Output for any errors that may occur.

System.Boolean richTextError

If true then error message will be formatted with color tags. Otherwise, the error message will be formatted with text only.

Returns
Sirenix.Utilities.Editor.Expressions.ExpressionFunc<T1, T2, T3, T4, T5, T6, T7, T8, TResult>

Returns the emitted ExpressionFunc if the expression is compiled successfully. Otherwise, null.

Type Parameters
T1

T2

T3

T4

T5

T6

T7

T8

TResult

TryParseTypeNameAsCSharpIdentifier(String, out Type)
public static bool TryParseTypeNameAsCSharpIdentifier(string typeString, out Type type)
Parameters
System.String typeString

System.Type type

Returns
System.Boolean