def p_selection_statement_1(self, p): """ selection_statement : IF expression _NEWLINE statement """ if p[2] is None: print("ERROR at {}:{} : wrong format of check".format( p[4].coord.line, 10)) self._err_flag = True p[0] = tree.If(cond=p[2], iftrue=p[4], coord=self._token_coord(p, 1))
def p_selection_statement_4(self, p): """ selection_statement : IF expression _NEWLINE statement ELDEF _NEWLINE statement ELUND _NEWLINE statement """ p[0] = tree.If(cond=p[2], iftrue=p[4], iffalse=p[7], ifundef=p[10], coord=self._token_coord(p, 1))
def p_statement_condition(p): " statement : IF '(' statement ')' '{' block '}' " p[0] = tree.If(p[3], p[6])