#include // 生成字符串映射(根据需求选择#str或#name) static const char *token_strings[] = { #define X(str, subtype, tok) [tok] = #str, SCC_CTOK_TABLE #undef X #define X(str, subtype, tok, std) [tok] = #str, SCC_CKEYWORD_TABLE #undef X }; static scc_tok_subtype_t token_subtypes[] = { #define X(str, subtype, tok) [tok] = subtype, SCC_CTOK_TABLE #undef X #define X(str, subtype, tok, std) [tok] = subtype, SCC_CKEYWORD_TABLE #undef X }; scc_tok_subtype_t scc_get_tok_subtype(scc_tok_type_t type) { return token_subtypes[type]; } const char *scc_get_tok_name(scc_tok_type_t type) { return token_strings[type]; }