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); }
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(); } }
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); }
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); }
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); }
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); }
internal Count(ComputeStep step) { _step = step; }
internal AscendString(ComputeStep step) { _step = step; }
internal MinDouble(ComputeStep step) { _step = step; }
internal LiteralInt64(ComputeStep step, long value, string text) { _step = step; _text = text; _value = value; }
internal GreaterEqualDouble(ComputeStep step) { _step = step; }
internal XorLong(ComputeStep step) { _step = step; }
internal LiteralProperty(ComputeStep step, Property property, Func <Item> getItem) { Property = property; _getItem = getItem; _step = step; }
internal PlusDouble(ComputeStep step) { _step = step; }
internal Length(ComputeStep step) { _step = step; }
internal And1Long(ComputeStep step) { _step = step; }
internal LiteralStringArray(ComputeStep step, string[] value) { _step = step; _value = value; }
internal DescendInt64(ComputeStep step) { _step = step; }
internal AscendInt32(ComputeStep step) { _step = step; }
internal ConcatString(ComputeStep step) { _step = step; }
internal LiteralInt32(ComputeStep step, int value, string text) { _step = step; _text = text; _value = value; }
internal GreaterThanString(ComputeStep step) { _step = step; }
internal Or1Long(ComputeStep step) { _step = step; }
internal LiteralString(ComputeStep step, string value) { _step = step; _value = value; }
internal EqualString(ComputeStep step) { _step = step; }
internal DescendDouble(ComputeStep step) { _step = step; }
internal LiteralDateTime(ComputeStep step, DateTime value, string text) { _step = step; _text = text; _value = value; }
internal DescendDateTime(ComputeStep step) { _step = step; }
internal LiteralInt32Array(ComputeStep step, Int32[] value, string text) { _step = step; _text = text; _value = value; }
internal LiteralDouble(ComputeStep step, double value, string text) { _step = step; _text = text; _value = value; }