Inheritance: LiteralExpression
        override public object Clone()
        {
            DoubleLiteralExpression clone = new DoubleLiteralExpression();

            clone._lexicalInfo       = _lexicalInfo;
            clone._endSourceLocation = _endSourceLocation;
            clone._documentation     = _documentation;
            clone._isSynthetic       = _isSynthetic;
            clone._entity            = _entity;
            if (_annotations != null)
            {
                clone._annotations = (Hashtable)_annotations.Clone();
            }
            clone._expressionType = _expressionType;
            clone._value          = _value;
            clone._isSingle       = _isSingle;
            return(clone);
        }
        override public object Clone()
        {
            DoubleLiteralExpression clone = (DoubleLiteralExpression)FormatterServices.GetUninitializedObject(typeof(DoubleLiteralExpression));

            clone._lexicalInfo       = _lexicalInfo;
            clone._endSourceLocation = _endSourceLocation;
            clone._documentation     = _documentation;
            clone._entity            = _entity;
            if (_annotations != null)
            {
                clone._annotations = (Hashtable)_annotations.Clone();
            }

            clone._expressionType = _expressionType;
            clone._value          = _value;
            clone._isSingle       = _isSingle;
            return(clone);
        }
Example #3
0
 public override void OnDoubleLiteralExpression(DoubleLiteralExpression node)
 {
     BindExpressionType(node, node.IsSingle ? TypeSystemServices.SingleType : TypeSystemServices.DoubleType);
 }
Example #4
0
	protected DoubleLiteralExpression  double_literal() //throws RecognitionException, TokenStreamException
{
		DoubleLiteralExpression rle;
		
		IToken  neg = null;
		IToken  value = null;
		IToken  single = null;
		
				rle = null;
				string val;
			
		
		try {      // for error handling
			switch ( LA(1) )
			{
			case SUBTRACT:
			case DOUBLE:
			{
				{
					switch ( LA(1) )
					{
					case SUBTRACT:
					{
						neg = LT(1);
						match(SUBTRACT);
						break;
					}
					case DOUBLE:
					{
						break;
					}
					default:
					{
						throw new NoViableAltException(LT(1), getFilename());
					}
					 }
				}
				value = LT(1);
				match(DOUBLE);
				if (0==inputState.guessing)
				{
					
							val = value.getText();
							if (neg != null) val = neg.getText() + val;
							rle = new DoubleLiteralExpression(ToLexicalInfo(value), PrimitiveParser.ParseDouble(value, val));
						
				}
				break;
			}
			case FLOAT:
			{
				single = LT(1);
				match(FLOAT);
				if (0==inputState.guessing)
				{
					
							val = single.getText();
							val = val.Substring(0, val.Length-1);
							if (neg != null) val = neg.getText() + val;
							rle = new DoubleLiteralExpression(ToLexicalInfo(single), PrimitiveParser.ParseDouble(single, val, true), true);
						
				}
				break;
			}
			default:
			{
				throw new NoViableAltException(LT(1), getFilename());
			}
			 }
		}
		catch (RecognitionException ex)
		{
			if (0 == inputState.guessing)
			{
				reportError(ex, "double_literal");
				recover(ex,tokenSet_44_);
			}
			else
			{
				throw ex;
			}
		}
		return rle;
	}
Example #5
0
 public override void OnDoubleLiteralExpression(DoubleLiteralExpression node)
 {
     IType type = node.ExpressionType ?? TypeSystemServices.DoubleType;
     EmitLoadLiteral(type, node.Value);
     PushType(type);
 }
		override public object Clone()
		{
		
			DoubleLiteralExpression clone = new DoubleLiteralExpression();
			clone._lexicalInfo = _lexicalInfo;
			clone._endSourceLocation = _endSourceLocation;
			clone._documentation = _documentation;
			clone._isSynthetic = _isSynthetic;
			clone._entity = _entity;
			if (_annotations != null) clone._annotations = (Hashtable)_annotations.Clone();
			clone._expressionType = _expressionType;
			clone._value = _value;
			clone._isSingle = _isSingle;
			return clone;


		}
		public override void OnDoubleLiteralExpression(DoubleLiteralExpression node)
		{
			if (node.IsSingle)
				MakeLiteralResult("System.Single");
			else
				MakeLiteralResult("System.Double");
		}
 public override void OnDoubleLiteralExpression(DoubleLiteralExpression node)
 {
     ReplaceWithCallToExpressionConstant(node);
 }
Example #9
0
 public override void OnDoubleLiteralExpression(DoubleLiteralExpression node)
 {
     if (node.IsSingle)
     {
         _il.Emit(OpCodes.Ldc_R4, (float)node.Value);
         PushType(TypeSystemServices.SingleType);
     }
     else
     {
         _il.Emit(OpCodes.Ldc_R8, node.Value);
         PushType(TypeSystemServices.DoubleType);
     }
 }
		public override void OnDoubleLiteralExpression(DoubleLiteralExpression node)
		{
			_expression = new CodePrimitiveExpression(node.Value);
		}
Example #11
0
 public override void OnDoubleLiteralExpression(DoubleLiteralExpression e)
 {
     Write(e.Value.ToString("########0.0##########", CultureInfo.InvariantCulture));
     if (e.IsSingle)
     {
         Write("F");
     }
 }
Example #12
0
        //throws RecognitionException, TokenStreamException
        protected LiteralExpression double_literal()
        {
            LiteralExpression  rle;

            IToken  neg = null;
            IToken  value = null;
            IToken  single = null;
            IToken  dec = null;

                rle = null;
                string val;

            try {      // for error handling
            switch ( LA(1) )
            {
            case SUBTRACT:
            case DOUBLE:
            {
                {
                    switch ( LA(1) )
                    {
                    case SUBTRACT:
                    {
                        neg = LT(1);
                        match(SUBTRACT);
                        break;
                    }
                    case DOUBLE:
                    {
                        break;
                    }
                    default:
                    {
                        throw new NoViableAltException(LT(1), getFilename());
                    }
                     }
                }
                value = LT(1);
                match(DOUBLE);
                if (0==inputState.guessing)
                {

                            val = value.getText();
                            if (neg != null) val = neg.getText() + val;
                            rle = new DoubleLiteralExpression(ToLexicalInfo(value), PrimitiveParser.ParseDouble(value, val));

                }
                break;
            }
            case FLOAT:
            {
                single = LT(1);
                match(FLOAT);
                if (0==inputState.guessing)
                {

                            val = single.getText();
                            val = val.Substring(0, val.Length-1);
                            if (neg != null) val = neg.getText() + val;
                            rle = new DoubleLiteralExpression(ToLexicalInfo(single), PrimitiveParser.ParseDouble(single, val, true), true);

                }
                break;
            }
            case DECIMAL:
            {
                dec = LT(1);
                match(DECIMAL);
                if (0==inputState.guessing)
                {

                    val = dec.getText();
                    val = val.Substring(0, val.Length-3); // "dec"
                    if (neg != null) val = neg.getText() + val;
                    rle = new DecimalLiteralExpression(ToLexicalInfo(dec), decimal.Parse(val, NumberStyles.Currency, CultureInfo.InvariantCulture));

                }
                break;
            }
            default:
            {
                throw new NoViableAltException(LT(1), getFilename());
            }
             }
            }
            catch (RecognitionException ex)
            {
            if (0 == inputState.guessing)
            {
                reportError(ex, "double_literal");
                recover(ex,tokenSet_41_);
            }
            else
            {
                throw ex;
            }
            }
            return rle;
        }