Exemple #1
0
        public override BlockStatement ParseBlock()
        {
            lexer.NextToken();
            compilationUnit = new CompilationUnit();

            BlockStatement blockStmt = new BlockStatement();

            blockStmt.StartLocation = la.Location;
            compilationUnit.BlockStart(blockStmt);

            while (la.kind != Tokens.EOF)
            {
                Token oldLa = la;
                Statement();
                if (la == oldLa)
                {
                    // did not advance lexer position, we cannot parse this as a statement block
                    return(null);
                }
            }

            compilationUnit.BlockEnd();
            Expect(Tokens.EOF);
            return(blockStmt);
        }
Exemple #2
0
        public override List <INode> ParseTypeMembers()
        {
            _lexer.NextToken();
            compilationUnit = new CompilationUnit();

            TypeDeclaration newType = new TypeDeclaration(Modifiers.None, null);

            compilationUnit.BlockStart(newType);
            ClassBody(newType);
            compilationUnit.BlockEnd();
            Expect(Tokens.EOF);
            return(newType.Children);
        }