Ejemplo n.º 1
0
        public override DomainId <IAstNode> VisitAndOrStatement(QlParser.AndOrStatementContext context)
        {
            var leftExpression  = Visit(context.leftExpression).To <IBooleanLogicNode>(m_domainItemLocator);
            var rightExpression = Visit(context.rightExpression).To <IBooleanLogicNode>(m_domainItemLocator);

            switch (context.booleanOperator().chosenOperator.Type)
            {
            case QlParser.AND:
                return(m_astFactory.CreateAndOperation(
                           context.GetText(),
                           leftExpression,
                           rightExpression));

            case QlParser.OR:
                return(m_astFactory.CreateOrOperation(
                           context.GetText(),
                           leftExpression,
                           rightExpression));

            default:
                throw new ParserException(
                          $@"Boolean Type '{context.booleanOperator().chosenOperator.Type}' handled in the parse tree but not by the AST",
                          null);
            }
        }