Exemplo n.º 1
0
        public override void EnterRule_action(Rule_actionContext context)
        {
            var contextParameter = Expression.Parameter(typeof(IContext), "context");
            var parameters       = new List <ParameterExpression> {
                contextParameter
            };

            parameters.AddRange(_parserContext.Scope.Values);

            using (_parserContext.PushScope())
            {
                var expressionParser = new ExpressionParser(_parserContext);
                var block            = expressionParser.Visit(context.statement_list());
                var lambda           = Expression.Lambda(block, parameters);
                _actionGroupBuilder.DslAction(_actionGroupBuilder.Declarations, lambda);
            }
        }
        public override void EnterRule_action(Rule_actionContext context)
        {
            var contextParameter = Expression.Parameter(typeof(IContext), "Context");
            var parameters       = new List <ParameterExpression> {
                contextParameter
            };

            parameters.AddRange(_parserContext.Scope.Declarations);

            using (_parserContext.PushScope())
            {
                _parserContext.Scope.Declare(contextParameter);

                var lambda = ParseActionExpression(context, parameters);
                _actionGroupBuilder.DslAction(_parserContext.Scope.Declarations, lambda);
            }
        }
Exemplo n.º 3
0
 public IRightHandSideExpression Action(Expression <Action <IContext> > action, ActionTrigger actionTrigger)
 {
     _builder.DslAction(_symbolStack.Scope.Declarations, action, actionTrigger);
     return(this);
 }