51#define ps_tstream_advance(tstream) ps_tstream_advance_n(tstream, 1)
Information captured in a file necessary for effective info/error reporting.
Processes tokens in a stream.
usize index
inv: 0 < index <= tokens->length.
const struct ps_token_arr * tokens
The tokens in the stream.
const struct ps_file_ctx * file_ctx
The file context for the stream.
ps_token_type
The type of a token.
struct ps_token * ps_tstream_match(struct ps_tstream *ts, enum ps_token_type type, STR ctx)
Attempts to match the next token with the given token type.
void ps_tstream_init(struct ps_tstream *ts, const struct ps_token_arr *tokens, const struct ps_file_ctx *file_ctx)
Points tstream to the first token in tokens and reads from it there on.
bool ps_tstream_is_eof(struct ps_tstream *ts)
Whether tstream has no more tokens.
struct ps_token * ps_tstream_current(struct ps_tstream *ts)
The current token in tstream.
struct ps_token * ps_tstream_peek(struct ps_tstream *ts, usize n, enum ps_token_type type)
If the nth next token in ts is of the given type, returns it.
struct ps_token * ps_tstream_match_any(struct ps_tstream *ts, enum ps_token_type types[], usize count, STR ctx)
Attempts to match the next token with one of the given token types.
void ps_tstream_advance_n(struct ps_tstream *ts, isize n)
Advances tstream to its nth next token.