if block_name == 'for':\r
return parse_block_for(ast)\r
\r
+ if block_name == 'if':\r
+ return parse_block_if(ast)\r
+\r
if block_name == 'with':\r
return parse_block_with(ast)\r
\r
\r
return from_import\r
\r
+def parse_block_if(ast):\r
+ test = parse_conditional_expression(ast['start']['parameters'][0]['value'])\r
+ body = parse(ast['contents'])\r
+ elif_ = None\r
+ else_ = None\r
+\r
+ return nodes.If(\r
+ test,\r
+ body,\r
+ elif_,\r
+ else_,\r
+ lineno=lineno_from_parseinfo(ast['parseinfo'])\r
+ )\r
+\r
def parse_block_with(ast):\r
with_node = nodes.With(\r
lineno=lineno_from_parseinfo(ast['parseinfo'])\r
return with_node\r
\r
def parse_comment(ast):\r
+ return\r
+\r
+def parse_conditional_expression(ast):\r
+ if 'variable' in ast:\r
+ return parse_variable(ast)\r
+\r
return None\r
\r
def parse_literal(ast):\r