// #include // #include "token.h" // #define ROUND_IDX(idx) ((idx) % tokbuf->cap) // #define POW2(x) (1 << (x)) // void init_toks(tok_stream_t* tokbuf, int cap, // tok_stream_close_func close, tok_stream_get_func gettok, void* stream) // { // tokbuf->cap_mask = POW2(cap) - 1; // // tokbuf->buf = // } // int toks_next( tok_stream_t* toks, tok_t* out); // int toks_peek( tok_stream_t* toks, tok_t* out, int lookahead); // const tok_t* toks_peek_ref(tok_stream_t* toks, int lookahead); // int toks_reset(tok_stream_t* toks); // int toks_seek( tok_stream_t* toks, int pos); // int toks_close(tok_stream_t* toks);