feat(pproc): 实现预处理器条件编译和可变参数宏支持
- 添加了完整的条件编译功能,包括 #if、#elif、#else、#endif 指令 - 实现了数值常量表达式的解析和求值 - 支持嵌套条件编译和与其他指令混合使用 - 实现了可变参数宏定义和 __VA_ARGS__ 替换功能 - 改进了宏展开机制以正确处理可变参数宏 - 重构了预处理器指令处理逻辑,提高了代码可维护性 - 添加了相应的单元测试用例验证新功能
This commit is contained in:
@@ -145,20 +145,21 @@ typedef enum scc_cstd {
|
||||
// END
|
||||
/* clang-format on */
|
||||
|
||||
// 定义TokenType枚举
|
||||
typedef enum scc_tok_type {
|
||||
// must first becase the unknown token must be 0
|
||||
/* clang-format off */
|
||||
// must first becase the unknown token must be 0
|
||||
#define X(str, subtype, tok) tok,
|
||||
SCC_CTOK_TABLE
|
||||
#undef X
|
||||
|
||||
#define X(name, type, tok) tok,
|
||||
SCC_PPKEYWORD_TABLE
|
||||
SCC_PPKEYWORD_TABLE
|
||||
#undef X
|
||||
|
||||
#define X(name, subtype, tok, std) tok,
|
||||
SCC_CKEYWORD_TABLE
|
||||
SCC_CKEYWORD_TABLE
|
||||
#undef X
|
||||
/* clang-format on*/
|
||||
} scc_tok_type_t;
|
||||
|
||||
typedef enum scc_tok_subtype {
|
||||
|
||||
Reference in New Issue
Block a user