Пример #1
0
 private string EvaluateLambda(string exp)
 {
     if (StringEscapeHelper.ContainsWithoutStrings(exp, "=>") && Regex.IsMatch(exp, RegexLambda))
     {
         return(BuildLambdaFunction(exp));
     }
     else
     {
         return(exp);
     }
 }
Пример #2
0
        /// <summary>
        /// Returns if the expression is an assignment statement.
        /// </summary>
        private static bool IsAssignmentStatement(string code)
        {
            if (StringEscapeHelper.ContainsWithoutStrings(code, "="))
            {
                // Replace "=" that are not the assignment operator with placeholders:
                code = code.Replace("===", "---");
                code = code.Replace("!==", "---");
                code = code.Replace("==", "--");
                code = code.Replace("!=", "--");
                code = code.Replace("=>", "--");
                code = code.Replace("<=", "--");
                code = code.Replace(">=", "--");

                return(StringEscapeHelper.ContainsWithoutStrings(code, "="));
            }
            else
            {
                return(false);
            }
        }