示例#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);
        }
示例#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();
            }
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#7
0
 internal Count(ComputeStep step)
 {
     _step = step;
 }
示例#8
0
 internal AscendString(ComputeStep step)
 {
     _step = step;
 }
示例#9
0
 internal MinDouble(ComputeStep step)
 {
     _step = step;
 }
示例#10
0
 internal LiteralInt64(ComputeStep step, long value, string text)
 {
     _step  = step;
     _text  = text;
     _value = value;
 }
示例#11
0
 internal GreaterEqualDouble(ComputeStep step)
 {
     _step = step;
 }
示例#12
0
 internal XorLong(ComputeStep step)
 {
     _step = step;
 }
示例#13
0
 internal LiteralProperty(ComputeStep step, Property property, Func <Item> getItem)
 {
     Property = property;
     _getItem = getItem;
     _step    = step;
 }
示例#14
0
 internal PlusDouble(ComputeStep step)
 {
     _step = step;
 }
示例#15
0
 internal Length(ComputeStep step)
 {
     _step = step;
 }
示例#16
0
 internal And1Long(ComputeStep step)
 {
     _step = step;
 }
示例#17
0
 internal LiteralStringArray(ComputeStep step, string[] value)
 {
     _step  = step;
     _value = value;
 }
示例#18
0
 internal DescendInt64(ComputeStep step)
 {
     _step = step;
 }
示例#19
0
 internal AscendInt32(ComputeStep step)
 {
     _step = step;
 }
示例#20
0
 internal ConcatString(ComputeStep step)
 {
     _step = step;
 }
示例#21
0
 internal LiteralInt32(ComputeStep step, int value, string text)
 {
     _step  = step;
     _text  = text;
     _value = value;
 }
示例#22
0
 internal GreaterThanString(ComputeStep step)
 {
     _step = step;
 }
示例#23
0
 internal Or1Long(ComputeStep step)
 {
     _step = step;
 }
示例#24
0
 internal LiteralString(ComputeStep step, string value)
 {
     _step  = step;
     _value = value;
 }
示例#25
0
 internal EqualString(ComputeStep step)
 {
     _step = step;
 }
示例#26
0
 internal DescendDouble(ComputeStep step)
 {
     _step = step;
 }
示例#27
0
 internal LiteralDateTime(ComputeStep step, DateTime value, string text)
 {
     _step  = step;
     _text  = text;
     _value = value;
 }
示例#28
0
 internal DescendDateTime(ComputeStep step)
 {
     _step = step;
 }
示例#29
0
 internal LiteralInt32Array(ComputeStep step, Int32[] value, string text)
 {
     _step  = step;
     _text  = text;
     _value = value;
 }
示例#30
0
 internal LiteralDouble(ComputeStep step, double value, string text)
 {
     _step  = step;
     _text  = text;
     _value = value;
 }