Ejemplo n.º 1
0
        private bool ConvertCodeFile(Stream inputStream, string outputPath, string name, CompilationUnit compilationUnit)
        {
            var input  = new AntlrInputStream(inputStream);
            var lexer  = new VisualBasic6Lexer(input);
            var tokens = new CommonTokenStream(lexer);
            var parser = new VisualBasic6Parser(tokens);
            var tree   = parser.startRule();

            var visitor = new ESCVisitor(name, compilationUnit);

            foreach (var node in visitor.Visit(tree))
            {
                // Just enumerate it all
            }

            var result = compilationUnit.Generate(name);

            File.WriteAllText(outputPath, result);

            return(true);
        }