public QueryNode Parse(string queryString)
        {
            var lexer   = new CypherLexer(new AntlrInputStream(queryString));
            var tokens  = new CommonTokenStream(lexer);
            var parser  = new CypherParser(tokens);
            var visitor = new CypherVisitor(_logger);
            var result  = visitor.Visit(parser.oC_Cypher()) as QueryNode;

            return(result);
        }
예제 #2
0
        public static Exception ValidateSyntax(this Query query)
        {
            var stream = CharStreams.fromString(query.Text);
            var lexer  = new CypherLexer(stream);
            var tokens = new CommonTokenStream(lexer);
            var parser = new CypherParser(tokens)
            {
                BuildParseTree = true,
                TrimParseTree  = true
            };

            var cypher = parser.oC_Cypher();

            return(cypher.exception);
        }