Beispiel #1
0
        public void Visit(ArrayMemberNode node)
        {
            AssertResolver();
            List<object> indexers = new List<object>();
            foreach (var indexerNode in node.Indexers)
            {
                indexerNode.Accept(this);
                indexers.Add(valueStack.Pop());
            }

            if (!node.LateEvaluation)
            {
                valueStack.Push(Resolver.ResolveArrayMember(node.Identifier, indexers));
            }
            else
            {
                var memberInfo =
                    new MemberInfo { Name = node.Identifier, MemberType = MemberType.Array };
                memberInfo.Arguments.AddRange(indexers);
                valueStack.Push(memberInfo);
            }
        }
Beispiel #2
0
 public void Visit(ArrayMemberNode node)
 {
     Debug.WriteLine("Visiting " + node.GetType().Name);
 }
Beispiel #3
0
 public void Visit(ArrayMemberNode node)
 {
     throw new NotImplementedException();
 }
Beispiel #4
0
        private Node IdentifierRest(string identifier, bool lateEvaluation)
        {
            Node result;
            List<Node> nodeList = null;

            if (lex.Token == Token.OpenParentheses)
            {
                //
                // Function call
                //
                lex.Next();
                if (lex.Token != Token.ClosedParentheses)
                {
                    nodeList = ExpressionList();
                    if (nodeList == null)
                    {
                        throw CreateErrorExpected("expression");
                    }
                    if (lex.Token != Token.ClosedParentheses)
                    {
                        throw CreateErrorExpectedToken(Token.ClosedParentheses);
                    }
                }
                lex.Next();
                var functionNode =
                    new FunctionNode { FunctionName = identifier, LateEvaluation = lateEvaluation };
                functionNode.Parameters.AddRange(nodeList);
                result = functionNode;
            }
            else if (lex.Token == Token.OpenBracket)
            {
                lex.Next();
                nodeList = ExpressionList();
                if (nodeList == null)
                {
                    throw CreateErrorExpected("array-indexing expression");
                }
                if (lex.Token != Token.ClosedBracket)
                {
                    throw CreateErrorExpectedToken(Token.ClosedBracket);
                }
                lex.Next();
                var arrayMemberNode = new ArrayMemberNode { Identifier = identifier, LateEvaluation = lateEvaluation };
                arrayMemberNode.Indexers.AddRange(nodeList);
                result = arrayMemberNode;
            }
            else
            {
                result = new IdentifierNode { Identifier = identifier, LateEvaluation = lateEvaluation };
            }

            return result;
        }