smcc/lib/utils/tokbuf/tokbuf.c
ZZY 2b4857001c feat(frontend): 重构词法分析器
- 添加 .gitignore 文件,忽略编译器生成的二进制文件
- 重构 lexer.c 文件,改进了关键字处理和字符串处理
- 更新前端的前端、解析器和 AST 相关文件,以适应新的词法分析器
- 优化了 token 相关的定义和函数,引入了新的 token 类型
2025-03-23 12:13:16 +08:00

20 lines
641 B
C

// #include <lib/rt/rt.h>
// #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);