Ejemplo n.º 1
0
 /// <summary>
 /// Creates an infinite constant based on the first character of the input.
 /// </summary>
 /// <remarks>
 /// Because this needs to work in APL mode also, we check the length of the input value.
 /// If it is above 3 then it is the negative infinity.
 /// </remarks>
 /// <param name="value">input: '-Inf' or 'Inf'</param>
 /// <returns>
 /// Returns an <see cref="AST.Constant"/> with a
 /// <see cref="ConstantType.NegativeInfinity"/> or <see cref="ConstantType.PositiveInfinity"/>.
 /// </returns>
 public static Constant InfConstant(string value)
 {
     // Check if value.Length > "Inf".Length
     if (value.Length > 3) // Magic Number: 3 is the length of 'Inf'
     {
         return(new Constant(StringProcessor.ProcessAPLNumber(value), ConstantType.NegativeInfinity));
     }
     else
     {
         return(new Constant(StringProcessor.ProcessAPLNumber(value), ConstantType.PositiveInfinity));
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Build a float constant.
 /// </summary>
 /// <param name="value">The float value as a string</param>
 /// <returns>Returns an <see cref="AST.Constant"/> with a <see cref="ConstantType.Double"/>.</returns>
 public static Constant FloatConstant(string value)
 {
     return(new Constant(StringProcessor.ProcessAPLNumber(value), ConstantType.Double));
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Build an integer constant.
 /// </summary>
 /// <param name="value">The integer value as a string</param>
 /// <returns>Returns an <see cref="AST.Constant"/> with a <see cref="ConstantType.Integer"/>.</returns>
 public static Constant IntConstant(string value)
 {
     return(new Constant(StringProcessor.ProcessAPLNumber(value), ConstantType.Integer));
 }