Example #1
0
 public ClassInfo(string Name, LiteEnv Env, SyntaxClassBodyStatementNode BodyNode, ClassInfo BaseClass)
 {
     this.Name_      = Name;
     this.BaseClass_ = BaseClass;
     this.Env_       = Env;
     this.Body_      = BodyNode;
 }
Example #2
0
        // class_block ::= "{" [ member ] { [ member ] } "}"
        private SyntaxClassBodyStatementNode ParseClassBodyNode()
        {
            if (!TokenStream_.TakeExpect(TokenType.Delimiter, "{", out Token Tok))
            {
                ExitCode_ = new ExitUnexpectedSymbolCode(Tok);
                return(null);
            }

            var Node = new SyntaxClassBodyStatementNode();

            if (TokenStream_.PeekExpect(TokenType.Delimiter, "}"))
            {
                TokenStream_.Take();
                return(Node);
            }

            while (!TokenStream_.IsEnd())
            {
                var Member = ParseClassMemberNode();
                if (Member == null)
                {
                    return(null);
                }
                Node.AddNode(Member);

                if (TokenStream_.PeekExpect(TokenType.Delimiter, "}"))
                {
                    TokenStream_.Take();
                    return(Node);
                }
            }

            ExitCode_ = new ExitUnexpectedSymbolCode(Tok);
            return(null);
        }
Example #3
0
        public LiteValue Visit(SyntaxClassBodyStatementNode Node, LiteEnv Env)
        {
            var Val = LiteValue.Nil;

            foreach (var Child in Node.GetChildren())
            {
                Val = Child.Accept(this, Env);
                if (Val.IsError())
                {
                    break;
                }
            }
            return(Val);
        }
Example #4
0
 public SyntaxClassNode(string ClassName, SyntaxClassBodyStatementNode BlockNode, SyntaxIdentifierNode BaseClassIdentNode)
     : base(BlockNode, BaseClassIdentNode)
 {
     ClassName_ = ClassName;
 }