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:
32
libs/sstream/include/scc_pos.h
Normal file
32
libs/sstream/include/scc_pos.h
Normal file
@@ -0,0 +1,32 @@
|
||||
#ifndef __SCC_POS_H__
|
||||
#define __SCC_POS_H__
|
||||
|
||||
#include <scc_core_str.h>
|
||||
#include <scc_core_type.h>
|
||||
|
||||
typedef struct scc_pos {
|
||||
const char *name;
|
||||
usize line;
|
||||
usize col;
|
||||
usize offset;
|
||||
} scc_pos_t;
|
||||
|
||||
static inline scc_pos_t scc_pos_create() { return (scc_pos_t){0, 1, 1, 0}; }
|
||||
|
||||
static inline void scc_pos_next(scc_pos_t *pos) {
|
||||
pos->offset++;
|
||||
pos->col++;
|
||||
}
|
||||
|
||||
static inline void scc_pos_next_offset(scc_pos_t *pos, int offset) {
|
||||
pos->offset += offset;
|
||||
pos->offset += offset;
|
||||
}
|
||||
|
||||
static inline void scc_pos_next_line(scc_pos_t *pos) {
|
||||
pos->offset++;
|
||||
pos->line++;
|
||||
pos->col = 1;
|
||||
}
|
||||
|
||||
#endif /* __SCC_POS_H__ */
|
||||
Reference in New Issue
Block a user