private void VisitMethodCall(MethodCallExpression expression)
        {
            VisitExpression(expression.Object);
            string methodName = expression.Method.Name;
            object objToInvokeUpon = returnValueFromLastExpressionVisit;

            MethodInfo methodInfo = objToInvokeUpon.GetType().GetMethod(methodName,
                                                                        BindingFlags.Public | BindingFlags.Instance);
            int paramCount = methodInfo.GetParameters().Count();
            Array paramArray = Array.CreateInstance(typeof (Object), paramCount);

            for (int arrLocation = 0; arrLocation < expression.Arguments.Count; arrLocation++)
            {
                Expression argument = expression.Arguments[arrLocation];
                VisitExpression(argument);
                if (argument is ConstantExpression)
                {
                    object argValue = ((ConstantExpression) argument).Value;
                    paramArray.SetValue(argValue, arrLocation);
                }
                else
                {
                    object argValue = returnValueFromLastExpressionVisit;
                    paramArray.SetValue(argValue, arrLocation);
                    Console.WriteLine();
                }
            }
            var array = (object[]) paramArray;
            returnValueFromLastExpressionVisit = methodInfo.Invoke(objToInvokeUpon, array);
            if (returnValueFromLastExpressionVisit is Pattern)
            {
                m_pattern = (Pattern) returnValueFromLastExpressionVisit;
            }
        }
 internal Quantifier(Pattern quantifiedExpression)
 {
     _quantifiedExpression = quantifiedExpression;
 }
 public LazyQuantifier(Pattern quantifiedExpression)
     : base(quantifiedExpression)
 {
 }
 public Pattern If(int unnamedCaptureToMatch, Pattern then, Pattern otherwise)
 {
     return _precedingPattern.RegEx(String.Format("(?({0}){1}|{2})", unnamedCaptureToMatch, then, otherwise));
 }
 public Pattern If(string namedGroupToMatch, Pattern then, Pattern otherwise)
 {
     return _precedingPattern.RegEx(String.Format("(?({0}){1}|{2})", namedGroupToMatch, then, otherwise));
 }
 public Pattern If(Pattern matched, Pattern then, Pattern otherwise)
 {
     return _precedingPattern.RegEx(String.Format("(?(?={0}){1}|{2})", matched, then, otherwise));
 }
 public Pattern Either(Pattern firstOption, Pattern secondOption)
 {
     return _precedingPattern.RegEx( String.Format("({0}|{1})", firstOption, secondOption) );
 }
 internal Alternation(Pattern precedingPattern)
 {
     _precedingPattern = precedingPattern;
 }