Class ExpressionEmbeddedCodePreparer
- Namespace
- Utils.Parser.Expressions
- Assembly
- Utils.Parser.Expressions.dll
Provides the supported runtime-inline compilation facade for embedded parser semantic predicates and inline actions. It validates and transforms embedded source through the shared transformation pipeline, builds expressions that read runtime symbols from the delegate context, delegates expression compilation to IExpressionCompiler, and materializes specialized CLR lambdas in strongly typed prepared artifacts. Preparation does not execute the embedded code or capture runtime values. This facade does not generate C# source, replace the source generator, compile lexer hooks, or select the parser's overall execution strategy.
public sealed class ExpressionEmbeddedCodePreparer : IEmbeddedCodePreparer<PreparedExpressionSemanticPredicate, PreparedExpressionParserAction>
- Inheritance
-
ExpressionEmbeddedCodePreparer
- Implements
- Inherited Members
- Extension Methods
Constructors
ExpressionEmbeddedCodePreparer(IExpressionCompiler, IParserEmbeddedCodeTransformer?)
Initializes the supported expression-backed runtime preparation facade.
public ExpressionEmbeddedCodePreparer(IExpressionCompiler compiler, IParserEmbeddedCodeTransformer? embeddedCodeTransformer = null)
Parameters
compilerIExpressionCompilerRequired caller-supplied compiler that converts validated transformed text into an expression tree. It is not called for unsupported categories or non-runtime targets and is called exactly once for each supported preparation.
embeddedCodeTransformerIParserEmbeddedCodeTransformerOptional transformer run through Utils.Parser.Diagnostics.EmbeddedCode.EmbeddedCodeTransformationPipeline before compiler invocation; Instance is used when no transformer is supplied.
Exceptions
- ArgumentNullException
Thrown when
compilerisnull.
Methods
PrepareParserAction(EmbeddedCodeSource, EmbeddedCodePreparationContext)
Prepares an ParserInlineAction for the RuntimeInlineExpression target without executing it.
public EmbeddedCodePreparationResult<PreparedExpressionParserAction> PrepareParserAction(EmbeddedCodeSource source, EmbeddedCodePreparationContext context)
Parameters
sourceEmbeddedCodeSourceRaw inline parser-action source and its parser metadata.
contextEmbeddedCodePreparationContextPreparation context that selects the runtime target and allowed contextual symbols.
Returns
- EmbeddedCodePreparationResult<PreparedExpressionParserAction>
Unsupported for another category, PreservedNotCompiled for another target, CompilationFailed after a transformation or compilation failure, or Succeeded with a PreparedExpressionParserAction containing an Action<T> over ParserActionExecutionContext. The shared pipeline transforms the source before runtime-bound symbol expressions are passed to the compiler. A non-void expression is normalized to an action whose value is ignored, and the resulting delegate is not invoked during preparation.
PrepareSemanticPredicate(EmbeddedCodeSource, EmbeddedCodePreparationContext)
Prepares a SemanticPredicate for the RuntimeInlineExpression target without evaluating it.
public EmbeddedCodePreparationResult<PreparedExpressionSemanticPredicate> PrepareSemanticPredicate(EmbeddedCodeSource source, EmbeddedCodePreparationContext context)
Parameters
sourceEmbeddedCodeSourceRaw semantic-predicate source and its parser metadata.
contextEmbeddedCodePreparationContextPreparation context that selects the runtime target and allowed contextual symbols.
Returns
- EmbeddedCodePreparationResult<PreparedExpressionSemanticPredicate>
Unsupported for another category, PreservedNotCompiled for another target, CompilationFailed after a transformation or compilation failure, or Succeeded with a PreparedExpressionSemanticPredicate containing a Func<T, TResult> over SemanticPredicateEvaluationContext. The shared pipeline transforms the source before runtime-bound symbol expressions are passed to the compiler; the resulting delegate is not invoked during preparation.