docs: 更新语法规范并添加项目规则说明

- 更新 Snow 语言语法规范,调整错误分类表格格式和示例代码结构
This commit is contained in:
Luke 2025-07-14 23:03:09 +08:00
parent f820b9e9c0
commit d2a6bde8cd
2 changed files with 8 additions and 6 deletions

View File

@ -0,0 +1,2 @@
**添加规则文件可帮助模型精准理解你的编码偏好,如框架、代码风格等**
**规则文件只对当前工程生效单文件限制10000字符。如果无需将该文件提交到远程 Git 仓库,请将其添加到 .gitignore**

View File

@ -422,7 +422,7 @@ declare a: Point = Point(1, 2)
## 9 · 错误分类
| 编译期错误代码 | 产生条件 |
| ---------------------- | -------------------------- |
|----------------------|----------------------------|
| DuplicateName | 违反唯一性规则;结构体内有参数签名完全相同的构造函数 |
| UnresolvedIdentifier | 名字无法解析 |
| ReturnMissing | 非 void 函数缺少 return |
@ -430,7 +430,7 @@ declare a: Point = Point(1, 2)
| ImportCycle | (可选)检测到循环依赖 |
| CtorAmbiguous | 构造函数重载时参数匹配不唯一 |
| CtorNotFound | 构造函数重载时无匹配参数签名 |
|AccessDenied | 访问了以 `_` 开头的私有变量或方法但不在允许范围|
| AccessDenied | 访问了以 `_` 开头的私有变量或方法但不在允许范围 |
---
@ -517,10 +517,10 @@ module: RectExample
function: main
returns: int
body:
declare rect1: Rectangle = Rectangle(0, 0, 10, 10)
declare rect2: Rectangle = Rectangle(5, 6)
declare result: int = 0
body:
if rect1.area() > 50 then
loop:
init: