コード例 #1
0
        /// <summary>
        /// switch_state :
        ///     (WHEN rule_conditions)?
        ///     (
        ///           execute2* SWITCH key
        ///         | execute2+
        ///     )
        ///     ;
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override object VisitSwitch_state([NotNull] WorkflowParser.Switch_stateContext context)
        {
            var t = new TransitionConfig()
            {
            };

            if (context.WHEN() != null)
            {
                var condition = context.rule_conditions();
                t.WhenRuleText     = condition.GetText();
                t.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));
                t.WhenRule     = compilation.Item1;
                t.WhenRuleCode = compilation.Item2;
            }

            var executes = context.execute2();

            if (executes != null)
            {
                foreach (var execute in executes)
                {
                    t.RuleActions.Add((ResultRuleConfig)VisitExecute2(execute));
                }
            }

            if (context.SWITCH() != null)
            {
                t.TargetStateName = (string)VisitKey(context.key());
            }

            return(t);
        }
コード例 #2
0
 /// <summary>
 /// Visit a parse tree produced by <see cref="WorkflowParser.switch_state"/>.
 /// <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 VisitSwitch_state([NotNull] WorkflowParser.Switch_stateContext context)
 {
     return(VisitChildren(context));
 }
コード例 #3
0
 /// <summary>
 /// switch_state :
 ///     (WHEN rule_conditions)?
 ///     (
 ///           execute2* SWITCH key
 ///         | execute2+
 ///     )
 ///     ;
 /// </summary>
 /// <param name="context"></param>
 /// <returns></returns>
 public override object VisitSwitch_state([NotNull] WorkflowParser.Switch_stateContext context)
 {
     return(base.VisitSwitch_state(context));
 }