/// <summary> /// The recognize. /// </summary> /// <param name="expression"> /// The expression. /// </param> /// <param name="operations"> /// The operations. /// </param> /// <returns> /// The <see cref="RecognizedData"/>. /// </returns> public override RecognizedData Recognize(string expression, IDictionary<string, IOperation> operations) { var span = this.Index(expression); if (span != null) { var num = new NumberOperation(this.constValue); var newOperation = this.unaryOperationPrvider.GetOperation(num); return this.CreateResult(expression, span, newOperation); } return null; }
/// <summary> /// The recognize. /// </summary> /// <param name="expression"> /// The expression. /// </param> /// <param name="operations"> /// The operations. /// </param> /// <returns> /// The <see cref="RecognizedData"/>. /// </returns> public override RecognizedData Recognize(string expression, IDictionary<string, IOperation> operations) { var span = this.Index(expression); if (span != null) { double res; if (span.Fragment.TryParseAnyway(out res)) { var num = new NumberOperation(res); var newOperation = this.operationProvider.GetOperation(num); return this.CreateResult(expression, span, newOperation); } } return null; }