コード例 #1
0
        // #ASSIGN_STATEMENT ID #ARRAY ASSIGNMENT #EXPRESSION
        private void ConstructAssignArrayStatement()
        {
            var newValue = nodes.Pop() as AstExpression;

            List<AstArrayIndex> indices = new List<AstArrayIndex>();

            while (nodes.Peek() is AstArrayIndex)
            {
                indices.Insert(0, nodes.Pop() as AstArrayIndex);
            }
            AstExpressionList index = new AstExpressionList(indices.ToArray());
            var id = nodes.Pop() as AstIdExpression;
            var idArrExpression = new AstIdArrayExpression(id.Id, index);
            idArrExpression.SetTextPosition( tokenCurrPosition );
            var node = new AstAssignStatement(idArrExpression, newValue);
            PushNode(node);
        }
コード例 #2
0
        // #SIMPLE_TERM ID #ARRAY
        private void ConstructArrayUseSimpleTerm()
        {
            var indices = new List<AstArrayIndex>();
            var curr = nodes.Peek() as AstNode;
            while (curr is AstArrayIndex)
            {
                nodes.Pop();
                indices.Insert(0, curr as AstArrayIndex);
                curr = nodes.Peek() as AstNode;
            }

            var index = new AstExpressionList(indices.ToArray());

            var id = nodes.Pop() as AstIdExpression;

            var idArr = new AstIdArrayExpression(id.Id, index);
            idArr.SetTextPosition( tokenCurrPosition );
            var node = new AstSimpleTermExpr(idArr);
            PushNode(node);
        }