예제 #1
0
        private void ParseFilesWithGenerator(ClepsAbstractVisitor generator, CompileStatus status)
        {
            foreach (string fileName in Args.Files)
            {
                LexerParserErrorHandler lexerParserErrorHandler = new LexerParserErrorHandler(fileName, status);
                var data = File.ReadAllText(fileName);

                AntlrInputStream  s      = new AntlrInputStream(data);
                ClepsLexer        lexer  = new ClepsLexer(s);
                CommonTokenStream tokens = new CommonTokenStream(lexer);
                ClepsParser       parser = new ClepsParser(tokens);

                parser.RemoveErrorListeners();
                parser.AddErrorListener(lexerParserErrorHandler);
                var parsedFile = parser.compilationUnit();

                generator.ParseFile(fileName, parsedFile);
            }
        }
예제 #2
0
        private void ParseFilesWithGenerator(ClepsAbstractVisitor generator, CompileStatus status)
        {
            foreach (string fileName in Args.Files)
            {
                LexerParserErrorHandler lexerParserErrorHandler = new LexerParserErrorHandler(fileName, status);
                var data = File.ReadAllText(fileName);

                AntlrInputStream s = new AntlrInputStream(data);
                ClepsLexer lexer = new ClepsLexer(s);
                CommonTokenStream tokens = new CommonTokenStream(lexer);
                ClepsParser parser = new ClepsParser(tokens);

                parser.RemoveErrorListeners();
                parser.AddErrorListener(lexerParserErrorHandler);
                var parsedFile = parser.compilationUnit();

                generator.ParseFile(fileName, parsedFile);
            }
        }