refactor(lex_parser): 移除旧的词法解析器实现并更新依赖

移除了 libs/lex_parser 目录下的所有头文件和源文件,包括:
- lex_parser.h 和 lex_parser.c 核心解析功能
- 所有测试文件(test_char.c, test_identifier.c, test_number.c,
  test_skip_block_comment.c, test_skip_line.c, test_string.c)

更新了 lexer 模块的依赖配置,将 lex_parser 替换为 sstream,
同时更新了 lexer.h 中的相关包含头文件和数据结构定义,
简化了 scc_lexer_t 结构体的字段。
This commit is contained in:
zzy
2026-02-16 16:56:40 +08:00
parent 088050c903
commit 0e7dec202a
30 changed files with 1840 additions and 1979 deletions

View File

@@ -0,0 +1,33 @@
#ifndef __SCC_SSTREAM_H__
#define __SCC_SSTREAM_H__
#include "scc_pos.h"
#include <scc_core.h>
#include <scc_core_ring.h>
typedef struct {
scc_pos_t pos;
int character;
} scc_sstream_char_t;
typedef SCC_RING(scc_sstream_char_t) scc_sstream_ring_t;
typedef struct {
const char *fname;
scc_pos_t pos; // 当前消费位置 (可选,可由 ring 推导)
int used; // 是否仍然在使用
int owned_src; // 是否拥有src内存 即是否需要释放
const char *src; // 文件内容缓冲区 (由 sstream 管理)
usize len; // 缓冲区长度
scc_pos_t fill_pos; // 内部填充位置
scc_sstream_ring_t ring;
} scc_sstream_t;
int scc_sstream_init(scc_sstream_t *stream, const char *fname, int ring_size);
int scc_sstream_init_by_buffer(scc_sstream_t *stream, const char *buffer,
usize len, int owned, int ring_size);
scc_sstream_ring_t *scc_sstream_ref_ring(scc_sstream_t *stream);
void scc_sstream_drop_ring(scc_sstream_ring_t *ring);
void scc_sstream_drop(scc_sstream_t *stream);
#endif /* __SCC_SSTREAM_H__ */