tok(x)
consumes a token, if the kind
property of the token is exactly x
. It fails if it doesn't match the kind
property.
For example, for passing TypeScript's export statement:
export default Something;
We could write
seq(str('export'), str('default'), tok(TokenKind.Identifier), str(';'))
The meaning of the code is very obvious to us.