Example #1
0
        public static ModuleContext ParseSource(Stream stm)
        {
            AntlrInputStream input  = new AntlrInputStream(stm);
            ITokenStream     tokens = new CommonTokenStream(new VisualBasic6Lexer(input));

            VisualBasic6Parser parser = new VisualBasic6Parser(tokens);

            parser.AddParseListener(new ParserListener(parser));
            parser.AddErrorListener(new DebugErrorListener <IToken>());

            var ret = parser.module();

            if (parser.NumberOfSyntaxErrors > 0)
            {
                throw new ApplicationException("Parser errors encountered");
            }

            return(ret);
        }
Example #2
0
 public ParserListener(VisualBasic6Parser parser)
 {
     mParser = parser;
 }