') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); Add complete CovScript syntax guide documentation (Chapter 2) by Copilot · Pull Request #1 · covscript/handbook · GitHub
Skip to content

Add complete CovScript syntax guide documentation (Chapter 2) - #1

Merged
mikecovlee merged 9 commits into
mainfrom
copilot/add-covscript-syntax-guide
Dec 5, 2025
Merged

Add complete CovScript syntax guide documentation (Chapter 2)#1
mikecovlee merged 9 commits into
mainfrom
copilot/add-covscript-syntax-guide

Conversation

CopilotAI commented Dec 5, 2025

Copy link
Copy Markdown
Contributor

Systematic Documentation Review and Improvement

Phase 1: Critical Syntax Fixes

  • Fix remaining .size().size (20 instances fixed across 6 files)
    • syntax/07-modules.md: 4 fixes
    • syntax/08-memory.md: 3 fixes
    • syntax/10-iterators.md: 1 fix
    • syntax/11-stdlib.md: 7 fixes
    • syntax/12-advanced.md: 5 fixes
  • Review and fix all for loop syntax consistency
  • Verify pointer/reference usage (. vs ->)
  • Check string vs list method usage

Phase 2: Code Example Accuracy (Next)

  • Validate all code examples against test files
  • Ensure examples are runnable
  • Fix any remaining syntax errors

Phase 3: Documentation Structure

  • Improve comment clarity and consistency
  • Ensure proper section numbering
  • Verify cross-references

Phase 4: Style Consistency

  • Match official manual style
  • Consistent code block formatting
  • Clear CSC vs ECS distinctions
Original prompt

目标

covscript/handbook-zh 仓库中添加完整的 CovScript 语法指南文档,包括基础语法、数据类型、控制流、函数、面向对象编程等核心内容。

需要创建的文件

1. 创建 syntax/ 目录并添加以下文件:

syntax/README.md - 语法章节目录

内容应包含:

  • 章节标题:"贰 · 语法基础"
  • 简短介绍
  • 完整的子章节目录链接

syntax/01-basic.md - 基础语法

包含以下内容:

  • 2.1 注释(单行注释 #
  • 2.2 变量声明(var 关键字)
  • 2.3 常量声明(constant 关键字)
  • 2.4 多变量声明
  • 2.5 语句结束规则
  • 每个部分都需要包含代码示例

syntax/02-datatypes.md - 数据类型

包含以下内容:

  • 2.6 基本类型(数字、布尔、空值、字符、字符串)
  • 2.7 容器类型(数组、列表、键值对、哈希映射、哈希集合)
  • 2.8 类型检查(type()typeid
  • 包含丰富的代码示例,参考仓库中的测试文件

syntax/03-operators.md - 运算符

包含以下内容:

  • 2.9 算术运算符(+, -, *, /, %, ^, 自增自减)
  • 2.10 比较运算符
  • 2.11 逻辑运算符(&&, ||, !, and, or, not)
  • 2.12 赋值运算符
  • 2.13 特殊运算符(:, ->, *, &, [])
  • 每个运算符都要有示例

syntax/04-control-flow.md - 控制流

包含以下内容:

  • 2.14 条件语句(if, if-else, 多重条件)
  • 2.15 switch 语句
  • 2.16 循环语句(while, loop, loop-until, for, foreach)
  • 2.17 循环控制(continue, break, return)
  • 包含来自 covscript/covscript-example 的实际示例

syntax/05-functions.md - 函数

包含以下内容:

  • 2.18 函数定义
  • 2.19 无参数函数
  • 2.20 可变参数(...args
  • 2.21 Lambda 表达式
  • 2.22 函数参数类型标注
  • 2.23 返回值和多返回值
  • 参考 examples/stdutils.csp 等文件的示例

syntax/06-oop.md - 面向对象编程

包含以下内容:

  • 2.24 结构体(struct)
  • 2.25 类(class)
  • 2.26 构造函数(construct)
  • 2.27 继承(extends)
  • 2.28 方法重写(override)
  • 2.29 this 关键字和指针操作(&, ->)
  • 参考 tests/test_shared_cxt.csp 和 examples/picasso.csp 的示例

syntax/07-modules.md - 模块与包

包含以下内容:

  • 2.30 包定义(package)
  • 2.31 命名空间(namespace)
  • 2.32 导入模块(import, import as)
  • 2.33 using 语句
  • 参考 tests/constants.csp 和 examples/ 中的包示例

syntax/08-memory.md - 内存管理

包含以下内容:

  • 2.34 new 关键字
  • 2.35 指针(pointer, gcnew)
  • 2.36 指针操作(->, *, &)
  • 2.37 move 语义
  • 参考 tests/new.csc 的示例

syntax/09-exceptions.md - 异常处理

包含以下内容:

  • 2.38 抛出异常(throw)
  • 2.39 捕获异常(try-catch)
  • 2.40 自定义异常类
  • 参考 tests/file.csc 和 gmssl 项目中的异常处理示例

syntax/10-iterators.md - 迭代器

包含以下内容:

  • 2.41 获取迭代器(.begin, .end)
  • 2.42 迭代器操作(.next(), .data)
  • 2.43 迭代器方法
  • 参考 tests/list.csc 的迭代器使用示例

syntax/11-stdlib.md - 标准库

包含以下内容:

  • 2.44 输入输出(system.out, system.in, iostream)
  • 2.45 字符串操作
  • 2.46 类型转换
  • 2.47 数学运算
  • 2.48 系统操作(system.path, system.file)
  • 2.49 运行时操作(runtime)
  • 2.50 上下文操作(context)
  • 2.51 协程(fiber)
  • 2.52 编译时求值(@begin/@EnD
  • 2.53 特殊指令(@charset
  • 参考各个测试文件和示例文件

syntax/12-advanced.md - 高级特性

包含以下内容:

  • 2.54 do 表达式
  • 2.55 范围函数(range)
  • 2.56 链式调用
  • 2.57 初始化列表
  • 2.58 克隆(clone)
  • 2.59 类型转换(as)
  • 参考 argparse.ecs 等高级示例

2. 更新根目录的 README.md

在目录部分添加新章节链接:

## 目录+[壹 · 引言](./intro/README.md)+[贰 · 语法基础](./syntax/README.md)

代码示例来源

所有代码示例应该来自以下实际项目文件:

  • covscript/covscript 仓库的 tests/ 目录
  • covscript/covscript-example 仓库的 examples/ 目录
  • covscript/covscript-gmssl 仓库的相关文件

文档风格要求

  1. 使用中文编写,语言简洁易懂
  2. 深入浅出,适合初学者,同时涵盖高级特性
  3. 每个语法点都要有实际可运行的代码示例
  4. 代码块使用正确的语法高亮gsc 或 covscript)
  5. 结构清晰,使用合适的标题层级
  6. 与官方手册网站 https://manual.covscript.org.cn/ 的风格保持一致

参考资料

  • 官方文档:https://manual.covscript.org.cn/
  • 测试文件示例:tests/new.csc, tests/list.csc, tests/file.csc 等
  • 示例文件:examples/ls.csc, examples/ims.csc, examples/stdutils.csp 等

注意事项

  • 确保所有示例代码都是可运行的
  • 适当添加注释说明代码功能
  • 在适当的地方标注 CSC 和 ECS 的区别
  • 保持与现有文档风格一致

This pull request was created as a result of the following prompt from Copilot chat.

目标

covscript/handbook-zh 仓库中添加完整的 CovScript 语法指南文档,包括基础语法、数据类型、控制流、函数、面向对象编程等核心内容。

需要创建的文件

1. 创建 syntax/ 目录并添加以下文件:

syntax/README.md - 语法章节目录

内容应包含:

  • 章节标题:"贰 · 语法基础"
  • 简短介绍
  • 完整的子章节目录链接

syntax/01-basic.md - 基础语法

包含以下内容:

  • 2.1 注释(单行注释 #
  • 2.2 变量声明(var 关键字)
  • 2.3 常量声明(constant 关键字)
  • 2.4 多变量声明
  • 2.5 语句结束规则
  • 每个部分都需要包含代码示例

syntax/02-datatypes.md - 数据类型

包含以下内容:

  • 2.6 基本类型(数字、布尔、空值、字符、字符串)
  • 2.7 容器类型(数组、列表、键值对、哈希映射、哈希集合)
  • 2.8 类型检查(type()typeid
  • 包含丰富的代码示例,参考仓库中的测试文件

syntax/03-operators.md - 运算符

包含以下内容:

  • 2.9 算术运算符(+, -, *, /, %, ^, 自增自减)
  • 2.10 比较运算符
  • 2.11 逻辑运算符(&&, ||, !, and, or, not)
  • 2.12 赋值运算符
  • 2.13 特殊运算符(:, ->, *, &, [])
  • 每个运算符都要有示例

syntax/04-control-flow.md - 控制流

包含以下内容:

  • 2.14 条件语句(if, if-else, 多重条件)
  • 2.15 switch 语句
  • 2.16 循环语句(while, loop, loop-until, for, foreach)
  • 2.17 循环控制(continue, break, return)
  • 包含来自 covscript/covscript-example 的实际示例

syntax/05-functions.md - 函数

包含以下内容:

  • 2.18 函数定义
  • 2.19 无参数函数
  • 2.20 可变参数(...args
  • 2.21 Lambda 表达式
  • 2.22 函数参数类型标注
  • 2.23 返回值和多返回值
  • 参考 examples/stdutils.csp 等文件的示例

syntax/06-oop.md - 面向对象编程

包含以下内容:

  • 2.24 结构体(struct)
  • 2.25 类(class)
  • 2.26 构造函数(construct)
  • 2.27 继承(extends)
  • 2.28 方法重写(override)
  • 2.29 this 关键字和指针操作(&, ->)
  • 参考 tests/test_shared_cxt.csp 和 examples/picasso.csp 的示例

syntax/07-modules.md - 模块与包

包含以下内容:

  • 2.30 包定义(package)
  • 2.31 命名空间(namespace)
  • 2.32 导入模块(import, import as)
  • 2.33 using 语句
  • 参考 tests/constants.csp 和 examples/ 中的包示例

syntax/08-memory.md - 内存管理

包含以下内容:

  • 2.34 new 关键字
  • 2.35 指针(pointer, gcnew)
  • 2.36 指针操作(->, *, &)
  • 2.37 move 语义
  • 参考 tests/new.csc 的示例

syntax/09-exceptions.md - 异常处理

包含以下内容:

  • 2.38 抛出异常(throw)
  • 2.39 捕获异常(try-catch)
  • 2.40 自定义异常类
  • 参考 tests/file.csc 和 gmssl 项目中的异常处理示例

syntax/10-iterators.md - 迭代器

包含以下内容:

  • 2.41 获取迭代器(.begin, .end)
  • 2.42 迭代器操作(.next(), .data)
  • 2.43 迭代器方法
  • 参考 tests/list.csc 的迭代器使用示例

syntax/11-stdlib.md - 标准库

包含以下内容:

  • 2.44 输入输出(system.out, system.in, iostream)
  • 2.45 字符串操作
  • 2.46 类型转换
  • 2.47 数学运算
  • 2.48 系统操作(system.path, system.file)
  • 2.49 运行时操作(runtime)
  • 2.50 上下文操作(context)
  • 2.51 协程(fiber)
  • 2.52 编译时求值(@begin/@EnD
  • 2.53 特殊指令(@charset
  • 参考各个测试文件和示例文件

syntax/12-advanced.md - 高级特性

包含以下内容:

  • 2.54 do 表达式
  • 2.55 范围函数(range)
  • 2.56 链式调用
  • 2.57 初始化列表
  • 2.58 克隆(clone)
  • 2.59 类型转换(as)
  • 参考 argparse.ecs 等高级示例

2. 更新根目录的 README.md

在目录部分添加新章节链接:

## 目录+[壹 · 引言](./intro/README.md)+[贰 · 语法基础](./syntax/README.md)

代码示例来源

所有代码示例应该来自以下实际项目文件:

  • covscript/covscript 仓库的 tests/ 目录
  • covscript/covscript-example 仓库的 examples/ 目录
  • covscript/covscript-gmssl 仓库的相关文件

文档风格要求

  1. 使用中文编写,语言简洁易懂
  2. 深入浅出,适合初学者,同时涵盖高级特性
  3. 每个语法点都要有实际可运行的代码示例
  4. 代码块使用正确的语法高亮gsc 或 covscript)
  5. 结构清晰,使用合适的标题层级
  6. 与官方手册网站 https://manual.covscript.org.cn/ 的风格保持一致

参考资料

  • 官方文档:https://manual.covscript.org.cn/
  • 测试文件示例:tests/new.csc, tests/list.csc, tests/file.csc 等
  • 示例文件:examples/ls.csc, examples/ims.csc, examples/stdutils.csp 等

注意事项

  • 确保所有示例代码都是可运行的
  • 适当添加注释说明代码功能
  • 在适当的地方标注 CSC 和 ECS 的区别
  • 保持与现有文档风格一致

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

CopilotAIand others added 2 commits December 5, 2025 01:44
…control flow, functions, OOP, modules)
Co-authored-by: mikecovlee <16332179+mikecovlee@users.noreply.github.com>
Co-authored-by: mikecovlee <16332179+mikecovlee@users.noreply.github.com>
CopilotAI changed the title [WIP] Add complete CovScript syntax guide documentationAdd complete CovScript syntax guide documentation (Chapter 2)Dec 5, 2025
CopilotAI requested a review from mikecovleeDecember 5, 2025 01:51

@mikecovleemikecovlee left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

现有的文档,如 ./intro/hello.md、./intro/install.md 和 PR 中的内容显著脱离,请整合在一起

@mikecovleemikecovlee left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

再检查一下!有很多错漏

Comment threadsyntax/01-basic.md Outdated
var z = 30

# 链式赋值
var p = var q = var r = 0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这样是不行的

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修正。CovScript 不支持链式声明,已改为分别声明每个变量。(commit b54c601)

Comment threadsyntax/01-basic.md
- 变量名必须以字母或下划线开头
- 变量名可以包含字母、数字和下划线
- 变量名区分大小写
- 不能使用 CovScript 的关键字作为变量名

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以使用,但会造成不必要的混淆

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改为使用非关键字的示例(如 function)以避免混淆。(commit 021bbad)

Comment threadsyntax/02-datatypes.md Outdated

### 空值类型 (Null)

使用 `null` 表示空值或无效值。

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

null 本质上是个指针

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已添加说明:在 CovScript 中,null 本质上是一个空指针。(commit 021bbad)

var multiline = "First line\nSecond line"

# 字符串拼接
var greeting = "Hello, " + name + "!"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里是否应说明也可以使用.append方法

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已添加 .append 方法的说明。(commit 021bbad)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我想你应该搞混了,是string支持.append,不是list

Comment threadsyntax/02-datatypes.md Outdated
var greeting = "Hello, " + name + "!"

# 字符串长度
var len = str.size()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.size不需要加括号

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修正,.size 不需要加括号。(commit 021bbad)

Comment threadsyntax/03-operators.md Outdated

```covscript
# 结构体或类的指针访问
var obj = new MyClass()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

和其他语言不同,covscript是new申请正常对象,gcnew才是指针

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已添加说明:在 CovScript 中,new 创建普通对象(引用),gcnew 才创建指针。(commit 021bbad)

Comment threadsyntax/03-operators.md Outdated

```covscript
var value = 42
var ptr = gcnew value

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

应该是 var ptr = &value

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

或者 var ptr = gcnew number

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修正为 var ptr = &valuevar ptr = gcnew number 的正确语法。(commit 021bbad)

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已在示例中说明 gcnew number 的用法。(commit 021bbad)

Comment threadsyntax/04-control-flow.md Outdated

```covscript
# 基本 for 循环
for var i = 0; i < 5; ++i

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for后面不需要写var。而且在covscript中是for i=0,i<xxx,++i这种写法

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修正所有 for 循环语法为 for i=0,i<5,++i 格式(不使用 var,使用逗号分隔)。(commit 021bbad)


```covscript
# 可变参数函数
function sum(...args)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是否应说明,可变参函数的参数实际上是个数组

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已添加说明:可变参数实际上是一个数组,包含所有传入的参数。(commit 021bbad)

Comment threadsyntax/05-functions.md Outdated

## 2.5.6 函数参数类型标注

CovScript 支持为函数参数添加类型标注(主要用于文档和可读性)。

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里你再仔细看看文档。类型标注是ECS中的功能,作用是强制类型检查,会有一定的开销

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修正:类型标注是 ECS 中的功能,用于强制类型检查,会有运行时开销。同时区分了 ECS 的类型标注语法和 CSC 中的注释文档方式。(commit 021bbad)

CopilotAIand others added 2 commits December 5, 2025 02:24
…perations, and type annotations
Co-authored-by: mikecovlee <16332179+mikecovlee@users.noreply.github.com>
…and cross-references
Co-authored-by: mikecovlee <16332179+mikecovlee@users.noreply.github.com>

CopilotAI commented Dec 5, 2025

Copy link
Copy Markdown
ContributorAuthor

现有的文档,如 ./intro/hello.md、./intro/install.md 和 PR 中的内容显著脱离,请整合在一起

已完成整合:

  1. 补充了 intro/hello.md,添加了完整的 "Hello, World!" 示例和程序运行说明
  2. 在 intro/README.md 和 syntax/README.md 中添加了章节间的交叉引用
  3. 在 syntax/01-basic.md 开头添加了指向引言章节的引用
  4. 确保从安装、配置到语法学习的流程连贯

(commit b54c601)

再检查一下!有很多错漏

已完成全面检查和修正,主要包括:

  1. 修正所有 for 循环语法(使用逗号分隔,不使用 var 关键字)
  2. 修正 .size() 为 .size(属性访问不需要括号)
  3. 修正 pair 创建语法(使用冒号运算符而非 new pair)
  4. 修正指针操作说明(区分 new 和 gcnew)
  5. 修正点运算符和冒号运算符的说明
  6. 添加运算符重载、集合运算等缺失内容
  7. 区分 ECS 和 CSC 的类型标注功能
  8. 整合 intro 和 syntax 章节的内容流

(commits 021bbad, b54c601)

…nters (gcnew/&)
Co-authored-by: mikecovlee <16332179+mikecovlee@users.noreply.github.com>

@mikecovleemikecovlee left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment threadintro/hello.md
Comment threadsyntax/01-basic.md Outdated
constant y = 20
var z = 30

# 注意:CovScript 不支持链式声明

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不用特意强调

Comment threadsyntax/01-basic.md Outdated

## 2.1.5 语句结束规则

CovScript 中,每个语句通常独占一行,不需要使用分号结束。

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

也可以分号主动结束

var multiline = "First line\nSecond line"

# 字符串拼接
var greeting = "Hello, " + name + "!"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我想你应该搞混了,是string支持.append,不是list

@mikecovlee

Copy link
Copy Markdown
Member

@copilot 我刚才更新了最新的review,请根据review内容进行修改,谢谢!

….append clarification
Co-authored-by: mikecovlee <16332179+mikecovlee@users.noreply.github.com>

CopilotAI commented Dec 5, 2025

Copy link
Copy Markdown
ContributorAuthor

@copilot 我刚才更新了最新的review,请根据review内容进行修改,谢谢!

已完成最新 review 的修改:

  1. intro/hello.md:79 - 修正 ECS 文件运行说明,可直接执行(自动缓存编译)
  2. syntax/01-basic.md:62 - 移除链式声明的特意强调
  3. syntax/01-basic.md:71 - 添加分号可主动结束语句的说明
  4. syntax/02-datatypes.md:76 - 修正 .append 方法,它是字符串的方法而非列表的方法

我会继续参考您提供的测试文件和文档,对整个文档进行更细致的审查和完善。

(commit 5ae4313)

@mikecovlee

Copy link
Copy Markdown
Member

@copilot 让我们从头开始如何?现在有点乱了,请squash前面的更改,并标记所有的conversation为resolved

CopilotAI commented Dec 5, 2025

Copy link
Copy Markdown
ContributorAuthor

@copilot 让我们从头开始如何?现在有点乱了,请squash前面的更改,并标记所有的conversation为resolved

我理解您希望重新开始并整理提交历史。不过,我无法直接在 GitHub 上执行 squash commits 或标记 conversations 为 resolved 的操作,这些需要通过 GitHub 界面或特定的 git 命令来完成。

我可以提供两种方案:

方案1: 我可以基于您提供的参考资料(tests、examples、文档)重新审查和改进现有文档内容,然后创建新的提交。

方案2: 您可以先在 GitHub 上 squash 现有的提交并标记对话为 resolved,然后我继续进行文档改进工作。

请告诉我您更倾向哪种方案,或者如果您有其他建议,我会按照您的指示进行。

CopilotAI commented Dec 5, 2025

Copy link
Copy Markdown
ContributorAuthor

@copilot 请根据下面的资料(参考仓库中的 .csc/.csp/.ecs)对当前的更改进行审查、改进,并创建新的PR:
https://github.com/covscript/covscript/tree/master/tests
https://...

我理解您希望基于提供的参考资料对文档进行全面审查和改进。

不过需要说明的是,我无法创建新的 PR,只能在当前分支上继续改进文档内容。

我的建议方案:

  1. 我将基于您提供的参考资料(tests、examples、文档等)系统地审查和改进现有的文档
  2. 进行多轮迭代改进,每次改进后提交到当前分支
  3. 您可以在 GitHub 上决定是否 squash 这些提交

我现在开始对文档进行系统审查和改进吗?还是您希望我先等待您在 GitHub 上操作(比如 squash 提交)后再继续?

@mikecovlee

Copy link
Copy Markdown
Member

@copilot 方案1嘛

CopilotAI commented Dec 5, 2025

Copy link
Copy Markdown
ContributorAuthor

@copilot 方案1嘛

好的,我将开始方案1:基于您提供的参考资料系统地审查和改进文档。

我的工作计划:

  1. 首先审查所有文档的语法准确性(基于 tests/ 和 examples/ 中的实际代码)
  2. 修正代码示例中的错误和不准确之处
  3. 改进文档结构和注释风格
  4. 确保与官方手册风格一致

我会分阶段提交改进,便于您审查每一步的变更。现在开始工作。

Co-authored-by: mikecovlee <16332179+mikecovlee@users.noreply.github.com>
* Initial plan
* Fix iterator syntax: .begin, .end, .data are properties, not methods
Co-authored-by: mikecovlee <16332179+mikecovlee@users.noreply.github.com>
* Fix property syntax: .empty, .front, .back are properties without parentheses
Co-authored-by: mikecovlee <16332179+mikecovlee@users.noreply.github.com>
* Fix remaining iterator property usage in best practices section
Co-authored-by: mikecovlee <16332179+mikecovlee@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: mikecovlee <16332179+mikecovlee@users.noreply.github.com>
@mikecovlee
mikecovlee marked this pull request as ready for review December 5, 2025 05:37
@mikecovlee
mikecovlee merged commit 980e1b0 into mainDec 5, 2025
@mikecovlee
mikecovlee deleted the copilot/add-covscript-syntax-guide branch December 5, 2025 05:37
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@mikecovlee