feat(lex_parser): 初始化词法解析器模块

新增词法解析器库 `smcc_lex_parser`,包含基础的词法规则解析功能:
- 支持字符、字符串、数字、标识符的解析
- 支持跳过注释、空白符、行尾等辅助函数
- 提供对应的单元测试用例,覆盖各类合法与非法输入情况

该模块依赖 `libcore`,并被 `smcc_lex` 模块引用以支持更上层的词法分析逻辑。
This commit is contained in:
zzy
2025-11-23 22:53:46 +08:00
parent 67af0c6bf2
commit 871d031ceb
18 changed files with 996 additions and 392 deletions

View File

@@ -9,18 +9,10 @@
#include "lexer_token.h"
#include <libcore.h>
typedef struct lexer_loc {
const char *name;
usize name_len;
usize line;
usize column;
usize offset;
} lexer_loc_t;
typedef struct lexer_token {
token_type_t type;
core_cvalue_t value;
lexer_loc_t loc;
core_pos_t loc;
} lexer_tok_t;
/**
@@ -30,7 +22,7 @@ typedef struct lexer_token {
*/
typedef struct cc_lexer {
core_stream_t *stream;
lexer_loc_t pos;
core_pos_t pos;
} smcc_lexer_t;
/**