public List <string> GetAllVariables(string s)
        {
            var op  = new DefaultOperators();
            var set = new HashSet <string>();

            foreach (var item in op.Operators)
            {
                s = s.Replace(item.Symbol, " ");
            }

            s = s.Replace('(', ' ').Replace(')', ' ');

            var arr = s.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (var item in arr)
            {
                if (IsVariable(item))
                {
                    set.Add(item);
                }
            }

            var res = set.ToList();

            res.Sort();

            return(res);
        }
        /// <summary>
        ///     Default constructor, creates an ExpressionParser object
        /// </summary>
        public ExpressionParser()
        {
            // Cache for values and expressions
            Values = new ValuesDictionary();
            Expressions = new ExpressionDictionary();

            // Add all valid operators.
            var operators = new DefaultOperators();
            IDictionary<string, Operator> ops = new Dictionary<string, Operator>();

            foreach (var op in operators.Operators)
            {
                var symbol = op.Symbol;

                if (symbol.Length > maxOpLength)
                {
                    maxOpLength = symbol.Length;
                }

                ops.Add(symbol, op);
            }

            // Constants
            IDictionary<string, double> spconst = new Dictionary<string, double>();
            spconst.Add("euler", Math.E);
            spconst.Add("pi", Math.PI);
            spconst.Add("nan", Double.NaN);
            spconst.Add("infinity", Double.PositiveInfinity);
            spconst.Add("true", 1D);
            spconst.Add("false", 0D);

            treeParser = new TreeParser(ops, spconst);
            treeParser.ImplicitMultiplication = true;
            treeParser.RequireParentheses = true;

            Culture = CultureInfo.InvariantCulture;
        }