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