Ejemplo n.º 1
0
        static void ResolveMultiply(ComputeStep step)
        {
            var type      = step.Evaluate.GetType();
            var group     = step.Input[0].Evaluate.ValGroup;
            var composite = step.ScanInputsAndReturnCompositeValueGroup();

            switch (group)
            {
            case ValGroup.Long:
            case ValGroup.Double:
                if ((composite & ~ValGroup.ScalarGroup) != 0)
                {
                    step.Error = StepError.InvalidArgsRHS;
                }
                else if (type != typeof(MultiplyDouble))
                {
                    step.Evaluate = new MultiplyDouble(step);
                }
                break;

            default:
                step.Error = StepError.InvalidArgsLHS;
                break;
            }

            step.IsError      = (step.Error != StepError.None);
            step.IsChanged    = (type != step.Evaluate.GetType());
            step.IsUnresolved = (step.Evaluate.ValType == ValType.IsUnresolved);
        }
Ejemplo n.º 2
0
        protected Parser(string text)
        {
            Evaluate  = new LiteralParse(text);
            Step      = new ComputeStep(Evaluate);
            ParseType = StepType.Parse;

            if (Evaluate.IsEmpty)
            {
                Step.Error        = StepError.EmptyString;
                Step.ParseAborted = true;
            }
            else if (Evaluate.HasUnbalancedQuotes())
            {
                Step.Error        = StepError.UnbalancedQuotes;
                Step.ParseAborted = true;
            }
            else if (Evaluate.HasUnbancedParens())
            {
                Step.Error        = StepError.UnbalancedParens;
                Step.ParseAborted = true;
            }
            else
            {
                TryParse();
            }
        }
Ejemplo n.º 3
0
        static void ResolveAnd1(ComputeStep step)
        {
            var type      = step.Evaluate.GetType();
            var group     = step.Input[0].Evaluate.ValGroup;
            var composite = step.ScanInputsAndReturnCompositeValueGroup();

            if ((composite & ValGroup.String) != 0)
            {
                group = ValGroup.String;
            }

            switch (group)
            {
            case ValGroup.Bool:
                if ((composite & ~ValGroup.ScalarGroup) != 0)
                {
                    step.Error = StepError.InvalidArgsRHS;
                }
                else if (type != typeof(And2Bool))
                {
                    step.Evaluate = new And2Bool(step);
                }
                break;

            case ValGroup.Long:
                if ((composite & ~ValGroup.ScalarGroup) != 0)
                {
                    step.Error = StepError.InvalidArgsRHS;
                }
                else if ((composite & ValGroup.Double) != 0)
                {
                    step.Error = StepError.InvalidArgsRHS;
                }
                else
                {
                    if (type != typeof(And1Long))
                    {
                        step.Evaluate = new And1Long(step);
                    }
                }
                break;

            default:
                step.Error = StepError.InvalidArgsLHS;
                break;
            }

            step.IsError      = (step.Error != StepError.None);
            step.IsChanged    = (type != step.Evaluate.GetType());
            step.IsUnresolved = (step.Evaluate.ValType == ValType.IsUnresolved);
        }
Ejemplo n.º 4
0
        static void ResolveLength(ComputeStep step)
        {
            var type = step.Evaluate.GetType();

            if (step.Count == 1)
            {
                step.Evaluate = new Length(step);
            }
            else
            {
                step.Error = StepError.InvalidArgsRHS;
            }

            step.IsError      = (step.Error != StepError.None);
            step.IsChanged    = (type != step.Evaluate.GetType());
            step.IsUnresolved = (step.Evaluate.ValType == ValType.IsUnresolved);
        }
Ejemplo n.º 5
0
        static void ResolveAnd2(ComputeStep step)
        {
            var type      = step.Evaluate.GetType();
            var group     = step.Input[0].Evaluate.ValGroup;
            var composite = step.ScanInputsAndReturnCompositeValueGroup();

            if (composite == ValGroup.Bool)
            {
                step.Evaluate = new And2Bool(step);
            }
            else
            {
                step.Error = StepError.InvalidArgsLHS;
            }

            step.IsError      = (step.Error != StepError.None);
            step.IsChanged    = (type != step.Evaluate.GetType());
            step.IsUnresolved = (step.Evaluate.ValType == ValType.IsUnresolved);
        }
Ejemplo n.º 6
0
        static void ResolveMax(ComputeStep step)
        {
            var type  = step.Evaluate.GetType();
            var group = step.Input[0].Evaluate.ValGroup;

            switch (group)
            {
            case ValGroup.IntArray:
            case ValGroup.LongArray:
            case ValGroup.DoubleArray:
                step.Evaluate = new MaxDouble(step);
                break;

            default:
                step.Error = StepError.InvalidArgsRHS;
                break;
            }

            step.IsError      = (step.Error != StepError.None);
            step.IsChanged    = (type != step.Evaluate.GetType());
            step.IsUnresolved = (step.Evaluate.ValType == ValType.IsUnresolved);
        }
Ejemplo n.º 7
0
 internal Count(ComputeStep step)
 {
     _step = step;
 }
Ejemplo n.º 8
0
 internal AscendString(ComputeStep step)
 {
     _step = step;
 }
Ejemplo n.º 9
0
 internal MinDouble(ComputeStep step)
 {
     _step = step;
 }
Ejemplo n.º 10
0
 internal LiteralInt64(ComputeStep step, long value, string text)
 {
     _step  = step;
     _text  = text;
     _value = value;
 }
Ejemplo n.º 11
0
 internal GreaterEqualDouble(ComputeStep step)
 {
     _step = step;
 }
Ejemplo n.º 12
0
 internal XorLong(ComputeStep step)
 {
     _step = step;
 }
Ejemplo n.º 13
0
 internal LiteralProperty(ComputeStep step, Property property, Func <Item> getItem)
 {
     Property = property;
     _getItem = getItem;
     _step    = step;
 }
Ejemplo n.º 14
0
 internal PlusDouble(ComputeStep step)
 {
     _step = step;
 }
Ejemplo n.º 15
0
 internal Length(ComputeStep step)
 {
     _step = step;
 }
Ejemplo n.º 16
0
 internal And1Long(ComputeStep step)
 {
     _step = step;
 }
Ejemplo n.º 17
0
 internal LiteralStringArray(ComputeStep step, string[] value)
 {
     _step  = step;
     _value = value;
 }
Ejemplo n.º 18
0
 internal DescendInt64(ComputeStep step)
 {
     _step = step;
 }
Ejemplo n.º 19
0
 internal AscendInt32(ComputeStep step)
 {
     _step = step;
 }
Ejemplo n.º 20
0
 internal ConcatString(ComputeStep step)
 {
     _step = step;
 }
Ejemplo n.º 21
0
 internal LiteralInt32(ComputeStep step, int value, string text)
 {
     _step  = step;
     _text  = text;
     _value = value;
 }
Ejemplo n.º 22
0
 internal GreaterThanString(ComputeStep step)
 {
     _step = step;
 }
Ejemplo n.º 23
0
 internal Or1Long(ComputeStep step)
 {
     _step = step;
 }
Ejemplo n.º 24
0
 internal LiteralString(ComputeStep step, string value)
 {
     _step  = step;
     _value = value;
 }
Ejemplo n.º 25
0
 internal EqualString(ComputeStep step)
 {
     _step = step;
 }
Ejemplo n.º 26
0
 internal DescendDouble(ComputeStep step)
 {
     _step = step;
 }
Ejemplo n.º 27
0
 internal LiteralDateTime(ComputeStep step, DateTime value, string text)
 {
     _step  = step;
     _text  = text;
     _value = value;
 }
Ejemplo n.º 28
0
 internal DescendDateTime(ComputeStep step)
 {
     _step = step;
 }
Ejemplo n.º 29
0
 internal LiteralInt32Array(ComputeStep step, Int32[] value, string text)
 {
     _step  = step;
     _text  = text;
     _value = value;
 }
Ejemplo n.º 30
0
 internal LiteralDouble(ComputeStep step, double value, string text)
 {
     _step  = step;
     _text  = text;
     _value = value;
 }