예제 #1
0
        public override bool test(CSsemi.CSemiExp semi)
        {
            List <string> variablecountlist = null;
            Repository    repo_             = Repository.getInstance();

            if (semi.count >= 2)
            {
                variablecountlist = semi.FindVariablesList();
            }

            if (variablecountlist != null && variablecountlist.Count == 2)
            {
                string currclassName = DetectParentClass.getClassName(repo_.semi.lineCount);
                //if (currclassName != "")
                {
                    CSsemi.CSemiExp local = new CSsemi.CSemiExp();
                    local.displayNewLines = false;
                    local.Add(variablecountlist[0]).Add(variablecountlist[1]).Add(currclassName);
                    doActionsComposition(local);
                    return(true);
                }
            }

            return(false);
        }
예제 #2
0
        public override bool test(CSsemi.CSemiExp semi)
        {
            Repository repo_     = Repository.getInstance();
            int        index     = semi.Contains("(");
            int        endindex  = semi.Contains(")");
            int        loopindex = semi.FindAll(",");
            int        currindex = 0;
            bool       flag      = false;

            if (index != -1 && !isSpecialToken(semi[index - 1]))
            {
                string currclassName = DetectParentClass.getClassName(repo_.semi.lineCount);
                currindex = index;
                string functionname = semi[currindex - 1];
                for (int i = 0; i <= loopindex; i++)
                {
                    CSsemi.CSemiExp local = new CSsemi.CSemiExp();
                    local.displayNewLines = false;
                    local.Add(currclassName).Add(functionname).Add(semi[currindex + 1]).Add(semi[currindex + 2]);
                    doActionsUsing(local);
                    flag      = true;
                    currindex = index + 3;
                }
            }
            if (flag)
            {
                return(true);
            }

            return(false);
        }
예제 #3
0
        public override bool test(CSsemi.CSemiExp semi)
        {
            Repository repo_ = Repository.getInstance();
            int        index = semi.FindFirst("new");

            if (index != -1)
            {
                string          currclassName = DetectParentClass.getClassName(repo_.semi.lineCount);
                CSsemi.CSemiExp local         = new CSsemi.CSemiExp();
                // local semiExp with tokens for type and name
                local.displayNewLines = false;
                local.Add(semi[index + 1]).Add(semi[index - 2]).Add(currclassName);
                doActionsAggregation(local);
                return(true);
            }

            return(false);
        }