(parser)
| 6012 | return parser.requireElement("expression"); |
| 6013 | } |
| 6014 | static parse(parser) { |
| 6015 | if (!parser.matchToken("pick")) return; |
| 6016 | parser.matchToken("the"); |
| 6017 | if (parser.matchToken("first")) { |
| 6018 | var follows = parser.pushFollows("of", "from"); |
| 6019 | try { |
| 6020 | var count = parser.requireElement("expression"); |
| 6021 | } finally { |
| 6022 | parser.popFollows(follows); |
| 6023 | } |
| 6024 | var root = _PickCommand.parseSource(parser); |
| 6025 | return new _PickCommand("first", root, null, null, null, count); |
| 6026 | } |
| 6027 | if (parser.matchToken("last")) { |
| 6028 | var follows = parser.pushFollows("of", "from"); |
| 6029 | try { |
| 6030 | var count = parser.requireElement("expression"); |
| 6031 | } finally { |
| 6032 | parser.popFollows(follows); |
| 6033 | } |
| 6034 | var root = _PickCommand.parseSource(parser); |
| 6035 | return new _PickCommand("last", root, null, null, null, count); |
| 6036 | } |
| 6037 | if (parser.matchToken("random")) { |
| 6038 | var count = null; |
| 6039 | if (parser.currentToken().type === "NUMBER") { |
| 6040 | var follows = parser.pushFollows("of", "from"); |
| 6041 | try { |
| 6042 | count = parser.requireElement("expression"); |
| 6043 | } finally { |
| 6044 | parser.popFollows(follows); |
| 6045 | } |
| 6046 | } |
| 6047 | var root = _PickCommand.parseSource(parser); |
| 6048 | return new _PickCommand("random", root, null, null, null, count); |
| 6049 | } |
| 6050 | if (parser.matchToken("item") || parser.matchToken("items") || parser.matchToken("character") || parser.matchToken("characters")) { |
| 6051 | var follows = parser.pushFollows("of", "from"); |
| 6052 | try { |
| 6053 | var range = _PickCommand.parsePickRange(parser); |
| 6054 | } finally { |
| 6055 | parser.popFollows(follows); |
| 6056 | } |
| 6057 | var root = _PickCommand.parseSource(parser); |
| 6058 | return new _PickCommand("range", root, range, null, null); |
| 6059 | } |
| 6060 | if (parser.matchToken("match")) { |
| 6061 | parser.matchToken("of"); |
| 6062 | var follows = parser.pushFollows("of", "from"); |
| 6063 | try { |
| 6064 | var re = parser.parseElement("expression"); |
| 6065 | var flags = ""; |
| 6066 | if (parser.matchOpToken("|")) { |
| 6067 | flags = parser.requireTokenType("IDENTIFIER").value; |
| 6068 | } |
| 6069 | } finally { |
| 6070 | parser.popFollows(follows); |
| 6071 | } |
nothing calls this directly
no test coverage detected