(parser)
| 5670 | return parser.requireElement("expression"); |
| 5671 | } |
| 5672 | static parse(parser) { |
| 5673 | if (!parser.matchToken("pick")) return; |
| 5674 | parser.matchToken("the"); |
| 5675 | if (parser.matchToken("first")) { |
| 5676 | var follows = parser.pushFollows("of", "from"); |
| 5677 | try { |
| 5678 | var count = parser.requireElement("expression"); |
| 5679 | } finally { |
| 5680 | parser.popFollows(follows); |
| 5681 | } |
| 5682 | var root = _PickCommand.parseSource(parser); |
| 5683 | return new _PickCommand("first", root, null, null, null, count); |
| 5684 | } |
| 5685 | if (parser.matchToken("last")) { |
| 5686 | var follows = parser.pushFollows("of", "from"); |
| 5687 | try { |
| 5688 | var count = parser.requireElement("expression"); |
| 5689 | } finally { |
| 5690 | parser.popFollows(follows); |
| 5691 | } |
| 5692 | var root = _PickCommand.parseSource(parser); |
| 5693 | return new _PickCommand("last", root, null, null, null, count); |
| 5694 | } |
| 5695 | if (parser.matchToken("random")) { |
| 5696 | var count = null; |
| 5697 | if (parser.currentToken().type === "NUMBER") { |
| 5698 | var follows = parser.pushFollows("of", "from"); |
| 5699 | try { |
| 5700 | count = parser.requireElement("expression"); |
| 5701 | } finally { |
| 5702 | parser.popFollows(follows); |
| 5703 | } |
| 5704 | } |
| 5705 | var root = _PickCommand.parseSource(parser); |
| 5706 | return new _PickCommand("random", root, null, null, null, count); |
| 5707 | } |
| 5708 | if (parser.matchToken("item") || parser.matchToken("items") || parser.matchToken("character") || parser.matchToken("characters")) { |
| 5709 | var follows = parser.pushFollows("of", "from"); |
| 5710 | try { |
| 5711 | var range = _PickCommand.parsePickRange(parser); |
| 5712 | } finally { |
| 5713 | parser.popFollows(follows); |
| 5714 | } |
| 5715 | var root = _PickCommand.parseSource(parser); |
| 5716 | return new _PickCommand("range", root, range, null, null); |
| 5717 | } |
| 5718 | if (parser.matchToken("match")) { |
| 5719 | parser.matchToken("of"); |
| 5720 | var follows = parser.pushFollows("of", "from"); |
| 5721 | try { |
| 5722 | var re = parser.parseElement("expression"); |
| 5723 | var flags = ""; |
| 5724 | if (parser.matchOpToken("|")) { |
| 5725 | flags = parser.requireTokenType("IDENTIFIER").value; |
| 5726 | } |
| 5727 | } finally { |
| 5728 | parser.popFollows(follows); |
| 5729 | } |
nothing calls this directly
no test coverage detected