(parser)
| 6637 | this.args = { value: expr }; |
| 6638 | } |
| 6639 | static parse(parser) { |
| 6640 | if (!parser.matchToken("if")) return; |
| 6641 | var expr = parser.requireElement("expression"); |
| 6642 | parser.matchToken("then"); |
| 6643 | var trueBranch = parser.parseElement("commandList"); |
| 6644 | var nestedIfStmt = false; |
| 6645 | let elseToken = parser.matchToken("else") || parser.matchToken("otherwise"); |
| 6646 | if (elseToken) { |
| 6647 | let elseIfIfToken = parser.peekToken("if"); |
| 6648 | nestedIfStmt = elseIfIfToken != null && elseIfIfToken.line === elseToken.line; |
| 6649 | if (nestedIfStmt) { |
| 6650 | var falseBranch = parser.parseElement("command"); |
| 6651 | } else { |
| 6652 | var falseBranch = parser.parseElement("commandList"); |
| 6653 | } |
| 6654 | } |
| 6655 | if (parser.hasMore() && !nestedIfStmt) { |
| 6656 | parser.requireToken("end"); |
| 6657 | } |
| 6658 | var ifCmd = new _IfCommand(expr, trueBranch, falseBranch); |
| 6659 | parser.setParent(trueBranch, ifCmd); |
| 6660 | parser.setParent(falseBranch, ifCmd); |
| 6661 | return ifCmd; |
| 6662 | } |
| 6663 | resolve(context, { value: exprValue }) { |
| 6664 | if (exprValue) { |
| 6665 | return this.trueBranch; |
nothing calls this directly
no test coverage detected