Beispiel #1
0
        internal static VbaLexer BuildVbaLexer(string source)
        {
            var errorHandler = new TestErrorListener();

            var input = new AntlrInputStream(source);

            var lexer = new VbaLexer(input);

            lexer.AddErrorListener(errorHandler);

            return(lexer);
        }
Beispiel #2
0
        internal static VbaParser BuildVbaParser(string source)
        {
            var errorHandler = new TestErrorListener();

            var input = new AntlrInputStream(source);

            var lexer = new VbaLexer(input);

            lexer.AddErrorListener(errorHandler);

            var tokens = new CommonTokenStream(lexer);

            var parser = new VbaParser(tokens);

            parser.AddErrorListener(errorHandler);
            parser.AddErrorListener(new DiagnosticErrorListener());
            parser.ErrorHandler = new BailErrorStrategy();
            return(parser);
        }