Exemplo n.º 1
0
 public bool FindParameter(string s, int ind)
 {
     fMethod = parser.inputSource.ListOfNamespaces[parser.statusOfNamepsace[parser.statusOfNamepsace.Count - 1]].NClasses[parser.statusOfClass[parser.statusOfClass.Count - 1]].CMethods[ind];
     for (int i = 0; i < fMethod.MVariable.Count; i++)
     {
         if (s.CompareTo(fMethod.MVariable[i].LName) == 0)
         {
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 2
0
        public void ParseInterfaceMethod()
        {
            FMethod fmMethod   = new FMethod();
            int     lastIndex  = parser.parseLine.ToString().IndexOf(";");
            int     startIndex = parser.parseLine.ToString().IndexOf("(");

            String[] method;
            method              = parser.parseLine.ToString().Substring(0, startIndex).Trim().Split(' ');
            fmMethod.MId        = parser.inputSource.ElementID;
            fmMethod.MName      = "";
            fmMethod.MSignature = "";
            fmMethod.mMccessControlQualifier = "";
            for (int i = method.Length - 1; i >= 0; i--)
            {
                if ((method[i] != "") && (method[i] != "\r\n") && (method[i] != "\n") && (method[i] != "\t"))
                {
                    if (fmMethod.MName == "" || fmMethod.MName == null)
                    {
                        fmMethod.MName = method[i];
                    }
                    else
                    {
                        if (fmMethod.MSignature == "")
                        {
                            fmMethod.MSignature = method[i] + fmMethod.MName;
                        }
                        else
                        {
                            if (fmMethod.mMccessControlQualifier == "")
                            {
                                if ((method[i] == "protected") || (method[i] == "public") || (method[i] == "private") || (method[i] == "internal"))
                                {
                                    fmMethod.mMccessControlQualifier = method[i];
                                }
                                //fmMethod.mMccessControlQualifier = method[i];
                            }
                        }
                    }
                }
            }
            fmMethod.MStub = false;
            parser.inputSource.ListOfNamespaces[parser.statusOfNamespace[parser.statusOfNamespace.Count - 1]].NClasses[parser.statusOfClass[parser.statusOfClass.Count - 1]].CMethods.Add(fmMethod);
            parser.inputSource.ElementID++;
            parser.parseLine.Remove(0, lastIndex + 1);
        }
Exemplo n.º 3
0
        public void ParseMethod(int index, int startIndex, bool isAbstratc)
        {
            int controlIndex = parseLine.ToString().IndexOf(":");

            if ((controlIndex > -1) && (controlIndex < startIndex))
            {
                CheckMethod(controlIndex);
            }
            FMethod fMethod = new FMethod();

            lastIndex = parseLine.ToString().IndexOf("(");
            String[] method = parseLine.ToString().Substring(0, lastIndex).Trim().Split(' ');

            fMethod.MId        = inputSource.ElementID;
            fMethod.MBelongsTo = inputSource.ListOfNamespaces[statusOfNamespace[statusOfNamespace.Count - 1]].NClasses[statusOfClass[statusOfClass.Count - 1]].CId;

            fMethod.MHasClassScope = false;
            fMethod.MKind          = "";//abstrakt
            //fMethod.MParameter;
            fMethod.MStub = false;
            fMethod.Loc   = LOC();
            //fMethod.MVariable
            for (int i = method.Length - 1; i > -1; i--)
            {
                if ((method[i] != "") && (method[i] != "\r\n") && (method[i] != "\n") && (method[i] != "\t"))
                {
                    if ((fMethod.MName == null) || (fMethod.MName == ""))
                    {
                        fMethod.MName = method[i];
                    }
                    else
                    {
                        //if ((fMethod.mMccessControlQualifier == null) || (fMethod.mMccessControlQualifier == ""))
                        //{
                        if ((method[i] == "protected") || (method[i] == "public") || (method[i] == "private") || (method[i] == "internal") || (method[i] == "abstract"))
                        {
                            fMethod.mMccessControlQualifier = method[i];
                        }

                        //}
                    }
                }
            }

            fMethod.MSignature = fMethod.MName + parseLine.ToString().Substring(lastIndex, index + 1 - lastIndex).Trim();
            inputSource.ListOfNamespaces[statusOfNamespace[statusOfNamespace.Count - 1]].NClasses[statusOfClass[statusOfClass.Count - 1]].CMethods.Add(fMethod);
            inputSource.ElementID++;


            if (isAbstratc == false)
            {
                parseLine.Remove(0, parseLine.ToString().IndexOf("{") + 1);
                ParseMethod parseMethod = new ParseMethod(this);
                //si this kjo mer klasen
                parseMethod.ParseMehodLine();
            }
            else
            {
                parseLine.Remove(0, parseLine.ToString().IndexOf(";") + 1);
            }
        }