示例#1
0
        /// <summary>Call Eval on specified command</summary>
        /// <param name="trigger"></param>
        /// <returns></returns>
        public virtual object EvalNext(CmdTrigger <C> trigger, object deflt)
        {
            if (!trigger.Text.ConsumeNext('('))
            {
                return(deflt);
            }
            string text = trigger.Text.NextWord(")");

            if (!trigger.Text.HasNext && !trigger.Text.String.EndsWith(")"))
            {
                return((object)null);
            }
            NestedCmdTrigger <C> nestedCmdTrigger = trigger.Nest(text);
            BaseCommand <C>      command          = this.GetCommand((CmdTrigger <C>)nestedCmdTrigger);

            if (command != null)
            {
                return(this.Eval((CmdTrigger <C>)nestedCmdTrigger, command));
            }
            return((object)false);
        }
示例#2
0
        /// <summary>
        /// Call Eval on specified command
        /// </summary>
        /// <param name="trigger"></param>
        /// <returns></returns>
        public virtual object EvalNext(CmdTrigger <C> trigger, object deflt)
        {
            if (trigger.Text.ConsumeNext('('))
            {
                var nestedCmdStr = trigger.Text.NextWord(")");
                if (!trigger.Text.HasNext && !trigger.Text.String.EndsWith(")"))
                {
                    // no closing bracket
                    return(null);
                }

                var forkTrigger = trigger.Nest(nestedCmdStr);
                var cmd         = GetCommand(forkTrigger);
                if (cmd != null)
                {
                    return(Eval(forkTrigger, cmd));
                }
                return(false);
            }
            // not an evaluatable expression
            return(deflt);
        }