Exemple #1
0
        /// <summary>
        /// Reads an operator from the given string expression, starting at the given position.
        /// </summary>
        /// <param name="expr">The expression to read the operator from.</param>
        /// <param name="pos">The position to start reading at.</param>
        /// <returns>The result of the read.</returns>
        internal ReadResult ReadOperator(string expr, int pos)
        {
            ReadResult result = new ReadResult()
            {
                Position = pos
            };
            char c = expr[pos];

            if (!char.IsWhiteSpace(c))
            {
                IOperationProvider provider = this.providerFactory.GetProvider(c);

                if (provider != null)
                {
                    result.Token    = provider.CreateOperator(c);
                    result.Position = pos + 1;
                    result.Success  = true;
                }
            }

            return(result);
        }