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