Exemplo n.º 1
0
        private Reference <T> BuildAstTree <T>(string definition) where T : IAstNode
        {
            var stream = new AntlrInputStream(definition);
            var lexer  = new QLLexer(stream);

            lexer.RemoveErrorListeners();
            lexer.AddErrorListener(new QlErrorListener());

            var tokens = new CommonTokenStream(lexer);

            var parser = new QLParser(tokens);

            parser.RemoveErrorListeners();
            parser.AddErrorListener(new QlErrorListener());

            var tree = parser.questionnaire();

            var qlVisitor = new BuildAstVisitor(m_astFactory, m_domainItemLocator);

            return(qlVisitor.Visit(tree).To <T>(m_domainItemLocator));
        }
Exemplo n.º 2
0
 private void AddErrorListener(QLParser parser)
 {
     parser.RemoveErrorListeners();
     parser.AddErrorListener(new AntlrErrorListener(Messages));
 }