override public object Clone()
        {
            CharLiteralExpression clone = (CharLiteralExpression)FormatterServices.GetUninitializedObject(typeof(CharLiteralExpression));

            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;
            return(clone);
        }
Beispiel #2
0
        override public object Clone()
        {
            CharLiteralExpression clone = new CharLiteralExpression();

            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;
            return(clone);
        }
Beispiel #3
0
 public override void OnCharLiteralExpression(CharLiteralExpression node)
 {
     CheckCharLiteralValue(node);
     BindExpressionType(node, TypeSystemServices.CharType);
 }
Beispiel #4
0
 private void CheckCharLiteralValue(CharLiteralExpression node)
 {
     var value = node.Value;
     if (value == null || value.Length != 1)
         Errors.Add(CompilerErrorFactory.InvalidCharLiteral(node, value));
 }
Beispiel #5
0
	protected Expression  char_literal() //throws RecognitionException, TokenStreamException
{
		Expression e;
		
		IToken  charToken = null;
		IToken  t = null;
		IToken  i = null;
		
			e = null;
		
		
		try {      // for error handling
			charToken = LT(1);
			match(CHAR);
			match(LPAREN);
			{
				switch ( LA(1) )
				{
				case SINGLE_QUOTED_STRING:
				{
					t = LT(1);
					match(SINGLE_QUOTED_STRING);
					if (0==inputState.guessing)
					{
						
									e = new CharLiteralExpression(ToLexicalInfo(t), t.getText());
								
					}
					break;
				}
				case INT:
				{
					i = LT(1);
					match(INT);
					if (0==inputState.guessing)
					{
						
									e = new CharLiteralExpression(ToLexicalInfo(i), (char) PrimitiveParser.ParseInt(i));
								
					}
					break;
				}
				case RPAREN:
				{
					if (0==inputState.guessing)
					{
						
									e = new MethodInvocationExpression(
												ToLexicalInfo(charToken),
												new ReferenceExpression(ToLexicalInfo(charToken), charToken.getText()));
								
					}
					break;
				}
				default:
				{
					throw new NoViableAltException(LT(1), getFilename());
				}
				 }
			}
			match(RPAREN);
		}
		catch (RecognitionException ex)
		{
			if (0 == inputState.guessing)
			{
				reportError(ex, "char_literal");
				recover(ex,tokenSet_44_);
			}
			else
			{
				throw ex;
			}
		}
		return e;
	}
Beispiel #6
0
 public override void OnCharLiteralExpression(CharLiteralExpression node)
 {
     EmitLoadLiteral((int) node.Value[0]);
     PushType(TypeSystemServices.CharType);
 }
Beispiel #7
0
 public override void OnCharLiteralExpression(CharLiteralExpression node)
 {
     string value = node.Value;
     if (null == value || 1 != value.Length)
     {
         Errors.Add(CompilerErrorFactory.InvalidCharLiteral(node, value));
     }
     BindExpressionType(node, TypeSystemServices.CharType);
 }
		public override void OnCharLiteralExpression(CharLiteralExpression node)
		{
			MakeLiteralResult("System.Char");
		}
Beispiel #9
0
        //throws RecognitionException, TokenStreamException
        protected Expression char_literal()
        {
            Expression e;

            IToken  t = null;
            IToken  i = null;

            e = null;

            try {      // for error handling
            match(CHAR);
            match(LPAREN);
            {
                switch ( LA(1) )
                {
                case SINGLE_QUOTED_STRING:
                {
                    t = LT(1);
                    match(SINGLE_QUOTED_STRING);
                    if (0==inputState.guessing)
                    {

                                    e = new CharLiteralExpression(SourceLocationFactory.ToLexicalInfo(t), t.getText());

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

                                    e = new CharLiteralExpression(SourceLocationFactory.ToLexicalInfo(i), (char) PrimitiveParser.ParseInt(i));

                    }
                    break;
                }
                default:
                {
                    throw new NoViableAltException(LT(1), getFilename());
                }
                 }
            }
            match(RPAREN);
            }
            catch (RecognitionException ex)
            {
            if (0 == inputState.guessing)
            {
                reportError(ex);
                recover(ex,tokenSet_27_);
            }
            else
            {
                throw ex;
            }
            }
            return e;
        }
Beispiel #10
0
 public override void OnCharLiteralExpression(CharLiteralExpression node)
 {
     _il.Emit(OpCodes.Ldc_I4, node.Value[0]);
     PushType(TypeSystemServices.CharType);
 }
		public override void OnCharLiteralExpression(CharLiteralExpression node)
		{
			_expression = new CodePrimitiveExpression(node.Value);
		}
		override public object Clone()
		{
		
			CharLiteralExpression clone = new CharLiteralExpression();
			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;
			return clone;


		}
Beispiel #13
0
 public override void OnCharLiteralExpression(CharLiteralExpression e)
 {
     WriteKeyword("char");
     Write("(");
     WriteStringLiteral(e.Value);
     Write(")");
 }