예제 #1
0
        /// <summary>
        /// execute3 :
        ///      (EXECUTE | key) action+
        ///    | STORE matchings+
        ///     ;
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override object VisitExecute3([NotNull] WorkflowParser.Execute3Context context)
        {
            List <ResultActionConfig> _actions = new List <ResultActionConfig>();

            if (context.STORE() != null)
            {
                var matchings = context.matchings();
                foreach (var item_matching in matchings)
                {
                    var _stores = (List <(string, string)>)VisitMatchings(item_matching);

                    foreach (var item in _stores)
                    {
                        var act = new ResultActionConfig()
                        {
                            Name  = "update " + item.Item1,
                            Label = $"update {item.Item1} to {item.Item2}",
                            Kind  = Constants.SetValueActionName,
                        }
                        .AddArgument("key", item.Item1)
                        .AddArgument("value", item.Item2)
                        ;

                        _actions.Add(act);
                    }
                }
            }
            else
            {
                string kind = context.EXECUTE() != null
                    ? Constants.PushActionName
                    : (string)VisitKey(context.key())
                ;

                var actions = context.action();
                foreach (var action in actions)
                {
                    var act = (ResultActionConfig)VisitAction(action);
                    act.Kind = kind;
                    _actions.Add(act);
                }
            }

            return(_actions);
        }
 /// <summary>
 /// Visit a parse tree produced by <see cref="WorkflowParser.execute3"/>.
 /// <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 VisitExecute3([NotNull] WorkflowParser.Execute3Context context)
 {
     return(VisitChildren(context));
 }
 /// <summary>
 /// execute3 :
 ///      (EXECUTE | key) action+
 ///    | STORE matchings+
 ///     ;
 /// </summary>
 /// <param name="context"></param>
 /// <returns></returns>
 public override object VisitExecute3([NotNull] WorkflowParser.Execute3Context context)
 {
     return(base.VisitExecute3(context));
 }