feat(build): 引入新的 Python 构建系统并移除旧 Makefile
新增基于 Python 的构建脚本 `cbuild.py`,支持包管理、依赖解析和模块化编译。 同时添加 `.gitignore` 忽略 `build` 目录,并在 `justfile` 中更新构建命令。 移除了原有的 `lib/Makefile` 和主目录下的相关 make 规则,统一使用新构建系统。
This commit is contained in:
37
libs/lexer/include/lexer_stream.h
Normal file
37
libs/lexer/include/lexer_stream.h
Normal file
@@ -0,0 +1,37 @@
|
||||
#include <core_type.h>
|
||||
|
||||
typedef struct lexer_stream lexer_stream_t;
|
||||
|
||||
#define lexer_stream_eof (-1)
|
||||
|
||||
struct lexer_stream {
|
||||
const char* name;
|
||||
usize name_len;
|
||||
|
||||
/// @brief 读取指定数量的字符到缓冲区
|
||||
usize (*read_buf)(lexer_stream_t* stream, char* buffer, usize count);
|
||||
|
||||
/// @brief 获取下一个字符
|
||||
int (*peek_char)(lexer_stream_t* stream);
|
||||
|
||||
/// @brief 重置字符流位置
|
||||
void (*reset_char) (lexer_stream_t* stream);
|
||||
|
||||
/// @brief 读取并消费下一个字符(移动流位置)
|
||||
int (*next_char)(lexer_stream_t* stream);
|
||||
|
||||
/// @brief 释放资源
|
||||
void (*free_stream) (lexer_stream_t* steam);
|
||||
};
|
||||
|
||||
#ifndef __SMCC_LEXER_NO_MEM_STREAM__
|
||||
typedef struct lexer_mem_stream {
|
||||
lexer_stream_t stream;
|
||||
const char* data;
|
||||
usize data_length;
|
||||
usize curr_pos;
|
||||
usize peek_pos;
|
||||
cbool owned;
|
||||
} lexer_mem_stream_t;
|
||||
lexer_stream_t* lexer_mem_stream_init(lexer_mem_stream_t* stream, const char* data, usize length, cbool need_copy);
|
||||
#endif
|
||||
Reference in New Issue
Block a user