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); }
public ParserListener(VisualBasic6Parser parser) { mParser = parser; }