Пример #1
0
        //Get Function Or Action
        public static ParserFunction GetFunctionOrAction(string item, ref string action)
        {
            ActionFunction actionFunction = GetAction(action);

            // Ако преминато действие съществува и е регистрирано, ние сме готови.
            if (actionFunction != null)
            {
                ActionFunction theAction = actionFunction.NewInstance() as ActionFunction;
                theAction.Name   = item;
                theAction.Action = action;

                action = null;
                return(theAction);
            }

            // В противен случай търсейте местни и глобални функции.
            ParserFunction pf = GetFunction(item);

            if (pf != null)
            {
                return(pf);
            }

            // функцията не е намерена, ще се опита да анализира това като низ в кавички или число.
            _strOrNumFunction.Item = item;
            return(_strOrNumFunction);
        }
Пример #2
0
        static ParserFunction GetRegisteredAction(string name, ParsingScript script, ref string action)
        {
            if (Constants.CheckReserved(name))
            {
                return(null);
            }

            if (ActionForUndefined(action) && script.Rest.StartsWith(Constants.UNDEFINED))
            {
                IsUndefinedFunction undef = new IsUndefinedFunction(name, action);
                return(undef);
            }

            ActionFunction actionFunction = GetAction(action);

            // If passed action exists and is registered we are done.
            if (actionFunction == null)
            {
                return(null);
            }

            ActionFunction theAction = actionFunction.NewInstance() as ActionFunction;

            theAction.Name   = name;
            theAction.Action = action;

            action = null;
            return(theAction);
        }
Пример #3
0
        static ParserFunction GetRegisteredAction(string name, ref string action)
        {
            ActionFunction actionFunction = GetAction(action);

            // If passed action exists and is registered we are done.
            if (actionFunction == null)
            {
                return(null);
            }

            ActionFunction theAction = actionFunction.NewInstance() as ActionFunction;

            theAction.Name   = name;
            theAction.Action = action;

            action = null;
            return(theAction);
        }
Пример #4
0
 // Add Action
 public static void AddAction(string name, ActionFunction action)
 {
     _actions[name] = action;
 }