Esempio n. 1
0
        public FuncInfo CreateCopy(ScriptFile sf)
        {
            FuncInfo f = new FuncInfo(sf, Name, Access, Summary, Returns, Self, Example, null);

            f.HasOutParams       = HasOutParams;
            f.OptParamStartIndex = OptParamStartIndex;
            f.Parameters         = Parameters;
            return(f);
        }
Esempio n. 2
0
        /// <summary>
        /// Nájde funkciu v globálnych súboroch.
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public FuncInfo FindGlobalsFunc(string name)
        {
            FuncInfo func = null;

            foreach (ScriptFile globalFile in this.SF.Manager.GetGlobalSFs())
            {
                func = globalFile.SI.FindLocalFunc(name);
                if (func != null)
                {
                    break;
                }
            }
            return(func);
        }
Esempio n. 3
0
        /// <summary>
        /// Nájde funkciu v includovaných súboroch.
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public FuncInfo FindIncludesFunc(string name)
        {
            FuncInfo func = null;

            foreach (IncludeInfo includeInfo in this.Includes)
            {
                if (includeInfo.SF.SI == null)
                {
                    continue;
                }

                func = includeInfo.SF.SI.FindLocalFunc(name);
                if (func != null)
                {
                    break;
                }
            }
            return(func);
        }
Esempio n. 4
0
        /// <summary>
        /// Nájde funkciu na všetkých dostupných miestach.
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public FuncInfo FindFunc(string name)
        {
            FuncInfo func = null;

            // search in local file...
            func = FindLocalFunc(name);
            if (func != null)
            {
                return(func);
            }

            // search in includes...
            func = FindIncludesFunc(name);
            if (func != null)
            {
                return(func);
            }

            // search in global files...
            func = FindGlobalsFunc(name);

            return(func);
        }
Esempio n. 5
0
 public void AddFunction(FuncInfo funcInfo)
 {
     Functions.Add(funcInfo);
     localMembers = null;
 }
Esempio n. 6
0
        private static void ReadFunc(ScriptInfo SI, XmlElement funcElem)
        {
            string       name    = string.Empty;
            MemberAccess access  = MemberAccess.Public;
            string       returns = string.Empty;
            string       summary = string.Empty;
            string       self    = string.Empty;
            string       example = string.Empty;

            List <FuncParamInfo> parameters = new List <FuncParamInfo>();

            name   = funcElem.GetAttribute("name");
            access = (MemberAccess)Enum.Parse(typeof(MemberAccess), funcElem.GetAttribute("access"));
            foreach (XmlNode curNode in funcElem)
            {
                if (!(curNode is XmlElement))
                {
                    continue;
                }

                XmlElement curElem = (XmlElement)curNode;

                if (curElem.Name == "summary")
                {
                    summary = curElem.InnerText;
                }
                else if (curElem.Name == "returns")
                {
                    returns = curElem.InnerText;
                }
                else if (curElem.Name == "self")
                {
                    self = curElem.InnerText;
                }
                else if (curElem.Name == "example")
                {
                    example = curElem.InnerText;
                }
                else if (curElem.Name == "param")
                {
                    string isOut     = curElem.GetAttribute("out");
                    string isOpt     = curElem.GetAttribute("opt");
                    bool   isOutBool = String.IsNullOrEmpty(isOut) ? false : Boolean.Parse(isOut);
                    bool   isOptBool = String.IsNullOrEmpty(isOpt) ? false : Boolean.Parse(isOpt);

                    parameters.Add(new FuncParamInfo(curElem.GetAttribute("name"), curElem.InnerText, isOutBool, isOptBool));
                }
                else
                {
                    throw new XmlException("Unknown ScriptInfo func node '" + curElem.Name + "'");
                }
            }

            FuncInfo funcInfo = new FuncInfo(SI.SF, name, access, summary, returns, self, example, null);

            foreach (FuncParamInfo param in parameters)
            {
                funcInfo.AddParam(param);
            }
            SI.AddFunction(funcInfo);
        }
Esempio n. 7
0
 /// <summary>
 /// Vytvorí referenciu priamo zo SC.
 /// </summary>
 /// <param name="funcInfo"></param>
 /// <param name="charIndex"></param>
 /// <param name="charLength"></param>
 /// <param name="isCall">Volá sa funkcia alebo sa len získava jej adresa?</param>
 public FuncRefInfo(ScriptFile sf, FuncInfo funcInfo, int charIndex, int charLength, string codePart, bool isCall)
     : this(sf, charIndex, charLength, codePart, isCall)
 {
     this._definition = funcInfo;
 }