Exemplo n.º 1
0
        public void Test1()
        {
            String text = @"  program a;
                            begin
                            end.";

            var normal =
                new GPascalParser(new CommonTokenStream(new GPascalLexer(new AntlrInputStream(text)))).program();
            var b = 2;
        }
Exemplo n.º 2
0
        public IFile ParseFile()
        {
            using (var def = Lifetime.Define())
            {
                var builder = new PsiBuilder(new PascalLexer(_lexer.Buffer), PascalNodeTypes.File, new TokenFactory(), def.Lifetime);

                var parser = new GPascalParser(new CommonTokenStream(new GPascalLexer(new AntlrInputStream(new BufferTextReader(_lexer.Buffer)))));
                parser.AddErrorListener(new PascalErrorListener(builder));

                var fileMark = builder.Mark();
                new PascalParserVisitor(builder).Visit(parser.program());
                builder.Done(fileMark, PascalNodeTypes.File, null);

                var file = (IFile)builder.BuildTree();
                return(file);
            }
        }