Ejemplo n.º 1
0
        /// <summary>
        /// execute2 :
        ///     (WHEN rule_conditions)?
        ///     (WAITING delay BEFORE)?
        ///     execute3+
        ///     ;
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override object VisitExecute2([NotNull] WorkflowParser.Execute2Context context)
        {
            ResultRuleConfig rule = new ResultRuleConfig()
            {
            };

            int delay = 0;

            if (context.WAITING() != null)
            {
                delay = (int)VisitDelay(context.delay());
            }


            if (context.WHEN() != null)
            {
                var condition = context.rule_conditions();
                rule.WhenRuleText     = condition.GetText();
                rule.WhenRulePosition = new RuleSpan()
                {
                    StartLine   = condition.Start.Line,
                    StartColumn = condition.Start.Column,
                    StartIndex  = condition.Start.StartIndex,

                    StopLine   = condition.Stop.Line,
                    StopColumn = condition.Stop.Column,
                    StopIndex  = condition.Stop.StopIndex,
                };

                var compilation = ((Func <RunContext, bool>, string))Compile((ExpressionModel)VisitRule_conditions(condition));
                rule.WhenRule     = compilation.Item1;
                rule.WhenRuleCode = compilation.Item2;
            }

            var a = context.execute3();

            foreach (var item1 in a)
            {
                var _a = (List <ResultActionConfig>)VisitExecute3(item1);
                foreach (var item2 in _a)
                {
                    item2.Delay = delay;
                    rule.Actions.Add(item2);
                }
            }

            return(rule);
        }
 /// <summary>
 /// Visit a parse tree produced by <see cref="WorkflowParser.execute2"/>.
 /// <para>
 /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/>
 /// on <paramref name="context"/>.
 /// </para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 /// <return>The visitor result.</return>
 public virtual Result VisitExecute2([NotNull] WorkflowParser.Execute2Context context)
 {
     return(VisitChildren(context));
 }
 /// <summary>
 /// execute2 :
 ///     (WHEN rule_conditions)?
 ///     (WAITING delay BEFORE)?
 ///     execute3+
 ///     ;
 /// </summary>
 /// <param name="context"></param>
 /// <returns></returns>
 public override object VisitExecute2([NotNull] WorkflowParser.Execute2Context context)
 {
     return(base.VisitExecute2(context));
 }