public override void Visit(Literal literal)
        {
            if (TrimFloatSuffix && literal.Value is float)
                literal.Text = literal.Text.Trim('f', 'F', 'l', 'L');

            base.Visit(literal);
        }
Exemple #2
0
        public virtual void Visit(Literal literal)
        {
            if (literal == null)
            {
                return;
            }

            var isStringLiteral = literal.Value is string && !literal.Text.StartsWith("\"");
            if (isStringLiteral)
            {
                Write("\"");
            }
            if (literal.SubLiterals != null && literal.SubLiterals.Count > 0)
            {
                foreach (var subLiteral in literal.SubLiterals) Write(subLiteral.Text);
            }
            else Write(literal.Text);
            if (isStringLiteral)
            {
                Write("\"");
            }
        }
 public LiteralIdentifier(Literal valueName)
     : base(valueName.ToString())
 {
     Value = valueName;
 }
Exemple #4
0
 /// <inheritdoc/>
 public bool Equals(Literal other)
 {
     if (ReferenceEquals(null, other))
     {
         return false;
     }
     if (ReferenceEquals(this, other))
     {
         return true;
     }
     return Equals(other.value, value);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="LiteralExpression"/> class.
 /// </summary>
 /// <param name="value">
 /// The value.
 /// </param>
 public LiteralExpression(object value)
 {
     Literal = new Literal(value);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="LiteralExpression"/> class.
 /// </summary>
 /// <param name="literal">
 /// The literal.
 /// </param>
 public LiteralExpression(Literal literal)
 {
     Literal = literal;
 }