if_statement : IF LPAREN expr RPAREN statement ELSE statement
188329
def p_if_statement_2(self, p):
        """"""
        p[0] = self.asttypes.If(
            predicate=p[3], consequent=p[5], alternative=p[7])
        p[0].setpos(p)
1255285
def p_exprle(p):
    
    a = int(p[1]) if p[1].isdigit() else 0
    b = int(p[3]) if p[3].isdigit() else 0

    p[0] = '1' if a <= b else '0'
1221317
def p_while_statement(p):
    ''''''
    if len(p) == 2:
        p[0] = p[1]
    else:
        p[0] = ast.Block(p[2], lineno=p.lineno(1))
387293
def p_statement(self, p):
        
        p[0] = ['statement', p[1][0], p[1][1]]

        if self.options.get('lowercasenames'):
            p[0][1] = p[0][1].lower()

        if (not self.options.get('nostripvalues') and
                not hasattr(p[0][2], 'is_single_quoted') and
                not hasattr(p[0][2], 'is_double_quoted')):
            p[0][2] = p[0][2].rstrip()
1118973
def p_statement_break(p):
    ''''''
    if len(p) == 3:
        p[0] = ast.Break(None, lineno=p.lineno(1))
    else:
        p[0] = ast.Break(p[2], lineno=p.lineno(1))
1303297
def Else(self, *Else, **kwargs):
        """"""
        root = self._root
        ast = self._ast

        next_else = E.Seq(*Else)._f
        ast = _add_else(ast, next_else)

        g = _compile_if(ast)

        return root.__then__(g, **kwargs)
934844
def parse_if(self):
        """"""
        node = result = nodes.If(lineno=self.stream.expect('name:if').lineno)
        while 1:
            node.test = self.parse_tuple(with_condexpr=False)
            node.body = self.parse_statements(('name:elif', 'name:else',
                                               'name:endif'))
            node.elif_ = []
            node.else_ = []
            token = next(self.stream)
            if token.test('name:elif'):
                node = nodes.If(lineno=self.stream.current.lineno)
                result.elif_.append(node)
                continue
            elif token.test('name:else'):
                result.else_ = self.parse_statements(('name:endif',),
                                                     drop_needle=True)
            break
        return result
1218575
def visit_IfStatement(self, node):
        """"""
        if_conditon, if_body = node.if_compound
        self.visit(if_conditon)
        self.visit(if_body)

        for else_if_compound in node.else_if_compounds:
            else_if_condition, else_if_body = else_if_compound
            self.visit(else_if_condition)
            self.visit(else_if_body)

        if node.else_compound is not None:
            _, else_body = node.else_compound
            self.visit(else_body)
871939
def ifelse(self, node):
        ''
        _, cond, _, cons, _, alt = node
        return self.eval(cons) if self.eval(cond) else self.eval(alt)
1033966
def p_Statement(p):
    '''
    
    '''
    if len(p) < 3:
        term = Terminator('')
    else:
        term = p[2]
    p[0] = Statement(p[1], term)
1130854
def or_else *default
      if empty? then
        res = if block_given? then
                yield
              else
                default.first
              end
        if res.is_a?(Option) then
          res
        else
          ::Collins::Option(res)
        end
      else
        self
      end
    end
309636
def p_if_expr_header(p):
    
    global ENABLED

    IFDEFS.append((ENABLED, p.lineno(1)))
    ENABLED = bool(int(p[2])) if p[2].isdigit() else ID_TABLE.defined(p[2])
349431
def p_conditional_expr(self, p):
        
        if len(p) == 2:
            p[0] = p[1]
        else:
            p[0] = ast.Conditional(
                predicate=p[1], consequent=p[3], alternative=p[5])
880651
def p_if_elseif(p):
    
    cond_ = p[1]
    stats_ = p[3] if len(p) == 5 else make_nop()
    eliflist = p[4] if len(p) == 5 else p[3]
    p[0] = make_sentence('IF', cond_, stats_, eliflist, lineno=p.lineno(2))
285216
def p_ifdef_else_b(p):
    
    global ENABLED

    if ENABLED:
        p[0] = ['#line %i "%s"%s' % (p.lineno(1) + 1, CURRENT_FILE[-1], p[2])]
        p[0] += p[3]
    else:
        p[0] = []
46129
def p_string_expr_lp(p):
    
    if p[2].type_ != TYPE.string:
        syntax_error(p.lexer.lineno,
                     "Expected a string type expression. "
                     "Got %s type instead" % TYPE.to_string(p[2].type_))
        p[0] = None
    else:
        p[0] = make_strslice(p.lexer.lineno, p[2], p[4][0], p[4][1])
494288
def p_generate_if(self, p):
        ''
        p[0] = IfStatement(p[3], p[5], p[7], lineno=p.lineno(1))
        p.set_lineno(0, p.lineno(1))