Exemplo n.º 1
0
        public static InvokeExpression Parse(string str)
        {
            Match            match  = Regex.Match(str, Pattern, RegexOptions.Multiline);
            InvokeExpression result = null;

            if (match.Success)
            {
                result = new InvokeExpression();

                if (match.Groups["assignationtype"].Value != "")
                {
                    result.ReturnVariableTypeAssignation =
                        match.Groups["assignationtype"].Value.Trim();
                }

                foreach (var capture in match.Groups["assignationtarget"].Captures)
                {
                    result.ReturnVariableAssignationTarget += capture;
                }
                if (result.ReturnVariableAssignationTarget != null &&
                    result.ReturnVariableAssignationTarget.EndsWith("."))
                {
                    result.ReturnVariableAssignationTarget =
                        result.ReturnVariableAssignationTarget.Remove(
                            result.ReturnVariableAssignationTarget.Length - 1, 1);     // remove dot
                }
                if (match.Groups["assignation"].Value != "")
                {
                    result.ReturnVariableAssignation =
                        match.Groups["assignation"].Value.Trim().
                        Replace("=", "").
                        Replace(":", "").
                        Replace("*", "").
                        Trim();
                }

                result.Preffix = match.Groups["stereotype"].Value;

                foreach (object capture in match.Groups["target"].Captures)
                {
                    result.Target += capture;
                }
                if (result.Target != null && result.Target.EndsWith("."))
                {
                    result.Target = result.Target.Remove(result.Target.Length - 1, 1);
                }
                // remove dot

                result.Name = match.Groups["name"].Value;

                result.Args = (from object capture in match.Groups["argument"].Captures
                               select capture.ToString().Trim().Replace(",", "")).ToArray();
            }

            return(result);
        }
Exemplo n.º 2
0
        public static InvokeExpression Parse(string str)
        {
            Match match = Regex.Match(str, Pattern, RegexOptions.Multiline);
            InvokeExpression result = null;

            if (match.Success)
            {
                result = new InvokeExpression();

                if (match.Groups["assignationtype"].Value != "")
                    result.ReturnVariableTypeAssignation =
                        match.Groups["assignationtype"].Value.Trim();

                foreach (var capture in match.Groups["assignationtarget"].Captures)
                {
                    result.ReturnVariableAssignationTarget += capture;
                }
                if (result.ReturnVariableAssignationTarget != null &&
                    result.ReturnVariableAssignationTarget.EndsWith("."))
                    result.ReturnVariableAssignationTarget =
                        result.ReturnVariableAssignationTarget.Remove(
                                result.ReturnVariableAssignationTarget.Length - 1, 1); // remove dot

                if (match.Groups["assignation"].Value != "")
                    result.ReturnVariableAssignation = 
						match.Groups["assignation"].Value.Trim().
                            Replace("=", "").
                            Replace(":", "").
                            Replace("*", "").
                            Trim();

                result.Preffix = match.Groups["stereotype"].Value;

                foreach (object capture in match.Groups["target"].Captures)
                {
                    result.Target += capture;
                }
                if (result.Target != null && result.Target.EndsWith("."))
                    result.Target = result.Target.Remove(result.Target.Length - 1, 1);
                        // remove dot

                result.Name = match.Groups["name"].Value;

            	result.Args = (from object capture in match.Groups["argument"].Captures
            	               select capture.ToString().Trim().Replace(",", "")).ToArray();
            }

            return result;
        }