Esempio n. 1
0
        public static InterfaceDefNode Parse(Lexer lex)
        {
            InterfaceDefNode n = new InterfaceDefNode();

            lex.Dequeue("interface");
            n.Identifier = ClassIdentNode.Parse(lex);

            if (ClassInheritNode.IsPresent(lex))
            {
                n.Parents = ClassInheritNode.Parse(lex);
            }

            while (GenericConstraintNode.IsPresent(lex))
            {
                n.Constraints.Add(GenericConstraintNode.Parse(lex));
            }

            lex.Dequeue(TokenType.LBrace);
            while (InterfaceEntryNode.IsPresent(lex))
            {
                n.Entries.Add(InterfaceEntryNode.Parse(lex));
            }
            lex.Dequeue(TokenType.RBrace);

            return(n);
        }
Esempio n. 2
0
        public static StructDefNode Parse(Lexer lex)
        {
            StructDefNode n = new StructDefNode();

            lex.Dequeue("struct");
            n.Identifier = ClassIdentNode.Parse(lex);
            if (ClassInheritNode.IsPresent(lex))
            {
                n.Parents = ClassInheritNode.Parse(lex);
            }


            while (GenericConstraintNode.IsPresent(lex))
            {
                n.Constraints.Add(GenericConstraintNode.Parse(lex));
            }

            lex.Dequeue(TokenType.LBrace);
            //TODO: CLASS_STRUCT_DEFS
            lex.Dequeue(TokenType.RBrace);
            return(n);
        }
Esempio n. 3
0
        public static ClassDefNode Parse(Lexer lex)
        {
            ClassDefNode n = new ClassDefNode();

            Token tkn;

            n.IsAbstract = lex.DequeueIf("abstract", out tkn);
            lex.Dequeue("class");
            n.Identifier = ClassIdentNode.Parse(lex);
            if (ClassInheritNode.IsPresent(lex))
            {
                n.Parents = ClassInheritNode.Parse(lex);
            }

            while (GenericConstraintNode.IsPresent(lex))
            {
                n.Constraints.Add(GenericConstraintNode.Parse(lex));
            }

            lex.Dequeue(TokenType.LBrace);
            //TODO: CLASS_STRUCT_DEFS
            lex.Dequeue(TokenType.RBrace);
            return(n);
        }