feat: 添加 const 关键字支持

- 在 TokenFactory 类中的 KEYWORDS 集合中添加了 "const" 关键字
- 此修改为编译器增加了对常量声明的支持,扩展了语言的功能
This commit is contained in:
Luke 2025-08-26 01:18:24 +08:00
parent c44f8a4630
commit 3b39e9059b

View File

@ -26,9 +26,9 @@ public class TokenFactory {
* 语言的保留关键字集合 * 语言的保留关键字集合
*/ */
private static final Set<String> KEYWORDS = Set.of private static final Set<String> KEYWORDS = Set.of
("module", "function", "params", "returns", "body", "end", ("module", "function", "params", "returns", "body", "end",
"if", "then", "else", "loop", "declare", "return", "import", "init", "if", "then", "else", "loop", "declare", "return", "import", "init",
"cond", "step", "globals", "break", "continue"); "cond", "step", "globals", "break", "continue", "const");
/** /**
* 内置类型名称集合 intstring * 内置类型名称集合 intstring