public ConditionCompiler(string expression)
        {
            var input   = new AntlrInputStream(expression);
            var lexer   = new QueryLanguageLexer(input);
            var tokens  = new CommonTokenStream(lexer);
            var parser  = new QueryLanguageParser(tokens);
            var visitor = new LogicalExpressionVisitor();

            _condition = visitor.Visit(parser.condition().LogicalExpression);
        }
예제 #2
0
        public ConditionCompiler(string expression)
        {
            var input   = new AntlrInputStream(expression);
            var lexer   = new QueryLanguageLexer(input);
            var tokens  = new CommonTokenStream(lexer);
            var parser  = new QueryLanguageParser(tokens);
            var visitor = new LogicalExpressionVisitor();

            OriginalExpression = expression;
            Expression         = visitor.Visit(parser.condition().LogicalExpression);
            if (Expression == null)
            {
                throw new ArgumentException($"Given expression '{expression}' cannot be parsed.");
            }
        }