| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // extension to python AST | ||
| 2 | #include "parser/parser.h" | ||
| 3 | |||
| 4 | #define TRACE_START2(tok) \ | ||
| 5 | kwtrace_start(depth, "{}: {} - `{}`", to_string(tok.type()).c_str(), tok.type(), tok.identifier()) | ||
| 6 | |||
| 7 | #define TRACE_START() TRACE_START2(token()) | ||
| 8 | |||
| 9 | namespace lython { | ||
| 10 | |||
| 11 | ExprNode* Parser::parse_ifexp_ext(Node* parent, int depth) { | ||
| 12 | TRACE_START(); | ||
| 13 | |||
| 14 | 1 | auto expr = parent->new_object<IfExp>(); | |
| 15 |
4/5✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 1 times.
|
1 | start_code_loc(expr, token()); |
| 16 | 1 | next_token(); | |
| 17 | |||
| 18 | 1 | expr->test = parse_expression(expr, depth + 1); | |
| 19 | expect_token(':', true, expr, LOC); | ||
| 20 | |||
| 21 | 1 | expr->body = parse_expression(expr, depth + 1); | |
| 22 | |||
| 23 | expect_token(tok_else, true, expr, LOC); | ||
| 24 | |||
| 25 | 1 | expr->orelse = parse_expression(expr, depth + 1); | |
| 26 | |||
| 27 |
4/5✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 1 times.
|
1 | end_code_loc(expr, token()); |
| 28 | 1 | return expr; | |
| 29 | } | ||
| 30 | } // namespace lython | ||
| 31 |