コード例 #1
0
        public IASTNode Parse()
        {
            // Parse the query string into an HQL AST.
            var lex = new HqlLexer(new CaseInsensitiveStringStream(_hql));

            _tokens = new CommonTokenStream(lex);

            var parser = new HqlParser(_tokens)
            {
                TreeAdaptor = new ASTTreeAdaptor(), Filter = _filter
            };

            if (log.IsDebugEnabled)
            {
                log.Debug("parse() - HQL: " + _hql);
            }

            try
            {
                var ast = (IASTNode)parser.statement().Tree;

                var walker = new NodeTraverser(new ConstantConverter(_sfi));
                walker.TraverseDepthFirst(ast);

                return(ast);
            }
            finally
            {
                parser.ParseErrorHandler.ThrowQueryException();
            }
        }
コード例 #2
0
		public IASTNode Parse()
		{
            // Parse the query string into an HQL AST.
            var lex = new HqlLexer(new CaseInsensitiveStringStream(_hql));
            _tokens = new CommonTokenStream(lex);

		    var parser = new HqlParser(_tokens) {TreeAdaptor = new ASTTreeAdaptor(), Filter = _filter};

		    if (log.IsDebugEnabled)
            {
                log.Debug("parse() - HQL: " + _hql);
            }

            try
            {
                var ast = (IASTNode) parser.statement().Tree;

                var walker = new NodeTraverser(new ConstantConverter(_sfi));
                walker.TraverseDepthFirst(ast);

                return ast;
            }
            finally
            {
                parser.ParseErrorHandler.ThrowQueryException();
            }
		}