(tokens)
| 473 | |
| 474 | |
| 475 | def ParseElseNode(tokens): |
| 476 | def Pop(token_type=None): |
| 477 | return PopToken(tokens, token_type) |
| 478 | |
| 479 | next = PeekToken(tokens) |
| 480 | if not next: |
| 481 | return None |
| 482 | if next.token_type == '$else': |
| 483 | Pop('$else') |
| 484 | Pop('[[') |
| 485 | code_node = ParseCodeNode(tokens) |
| 486 | Pop(']]') |
| 487 | return code_node |
| 488 | elif next.token_type == '$elif': |
| 489 | Pop('$elif') |
| 490 | exp = Pop('code') |
| 491 | Pop('[[') |
| 492 | code_node = ParseCodeNode(tokens) |
| 493 | Pop(']]') |
| 494 | inner_else_node = ParseElseNode(tokens) |
| 495 | return CodeNode([IfNode(ParseExpNode(exp), code_node, inner_else_node)]) |
| 496 | elif not next.value.strip(): |
| 497 | Pop('code') |
| 498 | return ParseElseNode(tokens) |
| 499 | else: |
| 500 | return None |
| 501 | |
| 502 | |
| 503 | def ParseAtomicCodeNode(tokens): |
no test coverage detected