Ejemplo n.º 1
0
 public static bool IsListMultiGenerator(ListLiteralExpression node)
 {
     if (1 == node.Items.Count)
     {
         NodeType itemType = node.Items[0].NodeType;
         return(NodeType.ExtendedGeneratorExpression == itemType);
     }
     return(false);
 }
Ejemplo n.º 2
0
		override public void OnListLiteralExpression(ListLiteralExpression node)
		{
			var generator = AstUtil.IsListGenerator(node);
			Visit(node.Items);
			if (generator)
				ReplaceCurrentNode(
					CodeBuilder.CreateConstructorInvocation(
						TypeSystemServices.Map(List_IEnumerableConstructor),
						node.Items[0]));
		}
Ejemplo n.º 3
0
        override public object Clone()
        {
            ListLiteralExpression clone = new ListLiteralExpression();

            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;
            if (null != _items)
            {
                clone._items = _items.Clone() as ExpressionCollection;
                clone._items.InitializeParent(clone);
            }
            return(clone);
        }
        override public object Clone()
        {
            ListLiteralExpression clone = (ListLiteralExpression)FormatterServices.GetUninitializedObject(typeof(ListLiteralExpression));

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

            clone._expressionType = _expressionType;
            if (null != _items)
            {
                clone._items = _items.Clone() as ExpressionCollection;
                clone._items.InitializeParent(clone);
            }
            return(clone);
        }
Ejemplo n.º 5
0
 public override void LeaveListLiteralExpression(ListLiteralExpression node)
 {
     BindExpressionType(node, TypeSystemServices.ListType);
     TypeSystemServices.MapToConcreteExpressionTypes(node.Items);
 }
Ejemplo n.º 6
0
		override public object Clone()
		{
		
			ListLiteralExpression clone = new ListLiteralExpression();
			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;
			if (null != _items)
			{
				clone._items = _items.Clone() as ExpressionCollection;
				clone._items.InitializeParent(clone);
			}
			return clone;


		}
Ejemplo n.º 7
0
	protected ListLiteralExpression  list_literal() //throws RecognitionException, TokenStreamException
{
		ListLiteralExpression e;
		
		IToken  lbrack = null;
		
				e = null;
				ExpressionCollection items = null;
			
		
		try {      // for error handling
			lbrack = LT(1);
			match(LBRACK);
			if (0==inputState.guessing)
			{
				
						e = new ListLiteralExpression(ToLexicalInfo(lbrack));
						items = e.Items;
					
			}
			list_items(items);
			match(RBRACK);
		}
		catch (RecognitionException ex)
		{
			if (0 == inputState.guessing)
			{
				reportError(ex, "list_literal");
				recover(ex,tokenSet_44_);
			}
			else
			{
				throw ex;
			}
		}
		return e;
	}
Ejemplo n.º 8
0
 public override void OnListLiteralExpression(ListLiteralExpression node)
 {
     if (node.Items.Count > 0)
     {
         EmitObjectArray(node.Items);
         _il.Emit(OpCodes.Ldc_I4_1);
         _il.Emit(OpCodes.Newobj, List_ArrayBoolConstructor);
     }
     else
     {
         _il.Emit(OpCodes.Newobj, List_EmptyConstructor);
     }
     PushType(TypeSystemServices.ListType);
 }
Ejemplo n.º 9
0
        //throws RecognitionException, TokenStreamException
        protected ListLiteralExpression list_initializer()
        {
            ListLiteralExpression e;

            IToken  lbrace = null;

                e = null;
                ExpressionCollection items = null;

            try {      // for error handling
            lbrace = LT(1);
            match(LBRACE);
            if (0==inputState.guessing)
            {

                        e = new ListLiteralExpression(ToLexicalInfo(lbrace));
                        items = e.Items;

            }
            list_items(items);
            match(RBRACE);
            }
            catch (RecognitionException ex)
            {
            if (0 == inputState.guessing)
            {
                reportError(ex, "list_initializer");
                recover(ex,tokenSet_73_);
            }
            else
            {
                throw ex;
            }
            }
            return e;
        }
Ejemplo n.º 10
0
 public override void LeaveListLiteralExpression(ListLiteralExpression node)
 {
     ConvertExpressions(node.Items);
 }
Ejemplo n.º 11
0
		public override void OnListLiteralExpression(ListLiteralExpression node)
		{
			MakeLiteralResult("Boo.Lang.List");
		}
Ejemplo n.º 12
0
 public override void OnListLiteralExpression(ListLiteralExpression node)
 {
     ReplaceWithCallToExpressionConstant(node);
 }
Ejemplo n.º 13
0
        //throws RecognitionException, TokenStreamException
        protected Expression list_literal()
        {
            Expression e;

            IToken  lbrack = null;

                e = null;
                ListLiteralExpression lle = null;
                Expression item = null;

            try {      // for error handling
            lbrack = LT(1);
            match(LBRACK);
            {
                switch ( LA(1) )
                {
                case ESEPARATOR:
                case CAST:
                case CHAR:
                case FALSE:
                case NOT:
                case NULL:
                case SELF:
                case SUPER:
                case TRUE:
                case TYPEOF:
                case TRIPLE_QUOTED_STRING:
                case DOUBLE_QUOTED_STRING:
                case SINGLE_QUOTED_STRING:
                case ID:
                case LBRACK:
                case LPAREN:
                case SUBTRACT:
                case SPLICE_BEGIN:
                case LBRACE:
                case QQ_BEGIN:
                case INCREMENT:
                case DECREMENT:
                case ONES_COMPLEMENT:
                case INT:
                case LONG:
                case RE_LITERAL:
                case DOUBLE:
                case FLOAT:
                case TIMESPAN:
                {
                    {
                        item=expression();
                        {
                            if (0==inputState.guessing)
                            {

                                                    e = lle = new ListLiteralExpression(SourceLocationFactory.ToLexicalInfo(lbrack));
                                                    lle.Items.Add(item);

                            }
                            {    // ( ... )*
                                for (;;)
                                {
                                    if ((LA(1)==COMMA) && (tokenSet_59_.member(LA(2))))
                                    {
                                        match(COMMA);
                                        item=expression();
                                        if (0==inputState.guessing)
                                        {
                                            lle.Items.Add(item);
                                        }
                                    }
                                    else
                                    {
                                        goto _loop528_breakloop;
                                    }

                                }
            _loop528_breakloop:								;
                            }    // ( ... )*
                        }
                        {
                            switch ( LA(1) )
                            {
                            case COMMA:
                            {
                                match(COMMA);
                                break;
                            }
                            case RBRACK:
                            {
                                break;
                            }
                            default:
                            {
                                throw new NoViableAltException(LT(1), getFilename());
                            }
                             }
                        }
                    }
                    break;
                }
                case RBRACK:
                {
                    if (0==inputState.guessing)
                    {
                        e = new ListLiteralExpression(SourceLocationFactory.ToLexicalInfo(lbrack));
                    }
                    break;
                }
                default:
                {
                    throw new NoViableAltException(LT(1), getFilename());
                }
                 }
            }
            match(RBRACK);
            }
            catch (RecognitionException ex)
            {
            if (0 == inputState.guessing)
            {
                reportError(ex);
                recover(ex,tokenSet_27_);
            }
            else
            {
                throw ex;
            }
            }
            return e;
        }
Ejemplo n.º 14
0
 public override void OnListLiteralExpression(ListLiteralExpression node)
 {
     Write("[");
     WriteCommaSeparatedList(node.Items);
     Write("]");
 }
Ejemplo n.º 15
0
 public static bool IsListMultiGenerator(ListLiteralExpression node)
 {
     if (1 == node.Items.Count)
     {
         NodeType itemType = node.Items[0].NodeType;
         return NodeType.ExtendedGeneratorExpression == itemType;
     }
     return false;
 }