Exemplo n.º 1
0
        private DictionaryCreationExpression ParseDictionaryCreation()
        {
            DictionaryCreationExpression dicNode = new DictionaryCreationExpression(_curtok);

            AssertAndAdvance(TokenId.LCurly);

            NodeCollection <NameExpressionNode> nodes = new NodeCollection <NameExpressionNode>();

            dicNode.Expressions = nodes;

            while (_curtok.TokenId != TokenId.RCurly && _curtok != _eof)
            {
                NameExpressionNode node = new NameExpressionNode(_curtok);

                Advance();

                AssertAndAdvance(TokenId.Colon);
                node.Expression = ParseExpression();
                nodes.Add(node);

                if (_curtok.TokenId == TokenId.Comma)
                {
                    Advance();
                }
            }

            return(dicNode);
        }
Exemplo n.º 2
0
        private DictionaryCreationExpression ParseDictionaryCreation()
        {
            DictionaryCreationExpression dicNode = new DictionaryCreationExpression(_curtok);
            AssertAndAdvance(TokenId.LCurly);

            NodeCollection<NameExpressionNode> nodes = new NodeCollection<NameExpressionNode>();

            dicNode.Expressions = nodes;

            while (_curtok.TokenId != TokenId.RCurly && _curtok != _eof)
            {
                NameExpressionNode node = new NameExpressionNode(_curtok);

                Advance();

                AssertAndAdvance(TokenId.Colon);
                node.Expression = ParseExpression();
                nodes.Add(node);

                if (_curtok.TokenId == TokenId.Comma)
                    Advance();
            }

            return dicNode;
        }