* @param {string} s * @param {!Element} context * @param {!TokenDef} tok * @param {Array } types * @param {*=} opt_value * @return {!TokenDef} * @private
(s, context, tok, types, opt_value)
| 1191 | * @private |
| 1192 | */ |
| 1193 | function assertTokenForParser(s, context, tok, types, opt_value) { |
| 1194 | if (opt_value !== undefined) { |
| 1195 | assertActionForParser( |
| 1196 | s, |
| 1197 | context, |
| 1198 | types.includes(tok.type) && tok.value == opt_value, |
| 1199 | `; expected [${opt_value}]` |
| 1200 | ); |
| 1201 | } else { |
| 1202 | assertActionForParser(s, context, types.includes(tok.type)); |
| 1203 | } |
| 1204 | return tok; |
| 1205 | } |
| 1206 | |
| 1207 | /** |
| 1208 | * @enum {number} |
nothing calls this directly
no test coverage detected