From ba511abf3c5eed23f4aef0fde0a3e6e0e8f3f41f Mon Sep 17 00:00:00 2001 From: Li Jin Date: Mon, 6 Jan 2025 17:31:36 +0800 Subject: Updated docs. --- doc/README.md | 4 +- doc/docs/.vuepress/components/YueCompiler.vue | 2 +- doc/docs/.vuepress/config.js | 6 +- doc/docs/.vuepress/public/image/yuescript.svg | 2 +- doc/docs/doc/README.md | 88 +++++++++++++-------------- doc/docs/try/README.md | 4 +- doc/docs/zh/doc/README.md | 44 +++++++------- doc/docs/zh/try/README.md | 2 +- 8 files changed, 76 insertions(+), 76 deletions(-) diff --git a/doc/README.md b/doc/README.md index 8300661..ec959d4 100755 --- a/doc/README.md +++ b/doc/README.md @@ -1,6 +1,6 @@ -# Yuescript +# YueScript -> Yuescript Documentation +> YueScript Documentation ## Development diff --git a/doc/docs/.vuepress/components/YueCompiler.vue b/doc/docs/.vuepress/components/YueCompiler.vue index 86d7566..6b6042c 100755 --- a/doc/docs/.vuepress/components/YueCompiler.vue +++ b/doc/docs/.vuepress/components/YueCompiler.vue @@ -2,7 +2,7 @@
-
Yuescript {{ info }}
+
YueScript {{ info }}
Lua
diff --git a/doc/docs/.vuepress/config.js b/doc/docs/.vuepress/config.js index 70ea66a..1fe44ce 100755 --- a/doc/docs/.vuepress/config.js +++ b/doc/docs/.vuepress/config.js @@ -4,7 +4,7 @@ module.exports = { /** * Ref:https://v1.vuepress.vuejs.org/config/#title */ - title: 'Yuescript', + title: 'YueScript', /** * Ref:https://v1.vuepress.vuejs.org/config/#description */ @@ -19,7 +19,7 @@ module.exports = { ['meta', { name: 'theme-color', content: '#3eaf7c' }], ['meta', { name: 'apple-mobile-web-app-capable', content: 'yes' }], ['meta', { name: 'apple-mobile-web-app-status-bar-style', content: 'black' }], - ['meta', { property: 'og:title', content: 'Yuescript' }], + ['meta', { property: 'og:title', content: 'YueScript' }], ['meta', { property: 'og:description', content: description }], // Should probably have a og:url but I'm not sure how to add that without it being the same on all pages ['meta', { property: 'og:type', content: 'website' }], @@ -49,7 +49,7 @@ module.exports = { locales: { '/': { lang: 'en-US', - title: 'Yuescript', + title: 'YueScript', description: 'A language that compiles to Lua' }, diff --git a/doc/docs/.vuepress/public/image/yuescript.svg b/doc/docs/.vuepress/public/image/yuescript.svg index b7e5884..87fdb45 100644 --- a/doc/docs/.vuepress/public/image/yuescript.svg +++ b/doc/docs/.vuepress/public/image/yuescript.svg @@ -11,7 +11,7 @@ ]> + xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="" viewBox="105 200 400 441.9" xml:space="preserve"> ## Introduction -Yuescript is a dynamic language that compiles to Lua. And it's a [Moonscript](https://github.com/leafo/moonscript) dialect. The codes written in Yuescript are expressive and extremely concise. And it is suitable for writing some changing application logic with more maintainable codes and runs in a Lua embeded environment such as games or website servers. +YueScript is a dynamic language that compiles to Lua. And it's a [MoonScript](https://github.com/leafo/moonscript) dialect. The codes written in YueScript are expressive and extremely concise. And it is suitable for writing some changing application logic with more maintainable codes and runs in a Lua embeded environment such as games or website servers. Yue (月) is the name of moon in Chinese and it's pronounced as [jyɛ]. -### An Overview of Yuescript +### An Overview of YueScript ```moonscript -- import syntax import "yue" as :p, :to_lua @@ -104,12 +104,12 @@ export 🌛 = "月之脚本" > make install ``` - Build Yuescript tool without macro feature: + Build YueScript tool without macro feature: ``` > make install NO_MACRO=true ``` - Build Yuescript tool without built-in Lua binary: + Build YueScript tool without built-in Lua binary: ``` > make install NO_LUA=true ``` @@ -118,17 +118,17 @@ export 🌛 = "月之脚本" ### Lua Module - Use Yuescript module in Lua: + Use YueScript module in Lua: * **Case 1** Require "your_yuescript_entry.yue" in Lua. ```Lua require("yue")("your_yuescript_entry") ``` - And this code still works when you compile "your_yuescript_entry.yue" to "your_yuescript_entry.lua" in the same path. In the rest Yuescript files just use the normal **require** or **import**. The code line numbers in error messages will also be handled correctly. + And this code still works when you compile "your_yuescript_entry.yue" to "your_yuescript_entry.lua" in the same path. In the rest YueScript files just use the normal **require** or **import**. The code line numbers in error messages will also be handled correctly. * **Case 2** -Require Yuescript module and rewite message by hand. +Require YueScript module and rewite message by hand. ```lua local yue = require("yue") local success, result = xpcall(function() @@ -139,7 +139,7 @@ end) ``` * **Case 3** -Use the Yuescript compiler function in Lua. +Use the YueScript compiler function in Lua. ```lua local yue = require("yue") local codes, err, globals = yue.to_lua([[ @@ -158,9 +158,9 @@ f! }) ``` -### Yuescript Tool +### YueScript Tool - Use Yuescript tool with: + Use YueScript tool with: ``` > yue -h Usage: yue [options|files|directories] ... @@ -190,12 +190,12 @@ Usage: yue [options|files|directories] ... in a single line to start/stop multi-line mode ```   Use cases: -  Recursively compile every Yuescript file with extension **.yue** under current path: **yue .** +  Recursively compile every YueScript file with extension **.yue** under current path: **yue .**   Compile and save results to a target path: **yue -t /target/path/ .**   Compile and reserve debug info: **yue -l .**   Compile and generate minified codes: **yue -m .**   Execute raw codes: **yue -e 'print 123'** -  Execute a Yuescript file: **yue -e main.yue** +  Execute a YueScript file: **yue -e main.yue** ## Macro @@ -264,13 +264,13 @@ if $and f1!, f2!, f3! ### Insert Raw Codes -A macro function can either return a Yuescript string or a config table containing Lua codes. +A macro function can either return a YueScript string or a config table containing Lua codes. ```moonscript macro yueFunc = (var)-> "local #{var} = ->" $yueFunc funcA funcA = -> "assign the Yue defined variable" --- take care and let Yuescript know the +-- take care and let YueScript know the -- local variables you declared in Lua code macro luaFunc = (var)-> { code: "local function #{var}() end" @@ -299,7 +299,7 @@ macro yueFunc = (var)-> "local #{var} = ->" $yueFunc funcA funcA = -> "assign the Yue defined variable" --- take care and let Yuescript know the +-- take care and let YueScript know the -- local variables you declared in Lua codes macro luaFunc = (var)-> { code: "local function #{var}() end" @@ -376,7 +376,7 @@ print $LINE -- get number 2 ### Generating Macros with Macros -In Yuescript, macro functions allow you to generate code at compile time. By nesting macro functions, you can create more complex generation patterns. This feature enables you to define a macro function that generates another macro function, allowing for more dynamic code generation. +In YueScript, macro functions allow you to generate code at compile time. By nesting macro functions, you can create more complex generation patterns. This feature enables you to define a macro function that generates another macro function, allowing for more dynamic code generation. ```moonscript macro Enum = (...) -> @@ -1353,7 +1353,7 @@ print ok, count, first ## Whitespace -Yuescript is a whitespace significant language. You have to write some code block in the same indent with space **' '** or tab **'\t'** like function body, value list and some control blocks. And expressions containing different whitespaces might mean different things. Tab is treated like 4 space, but it's better not mix the use of spaces and tabs. +YueScript is a whitespace significant language. You have to write some code block in the same indent with space **' '** or tab **'\t'** like function body, value list and some control blocks. And expressions containing different whitespaces might mean different things. Tab is treated like 4 space, but it's better not mix the use of spaces and tabs. ### Multiline Chaining @@ -2778,7 +2778,7 @@ switch item ## Object Oriented Programming -In these examples, the generated Lua code may appear overwhelming. It is best to focus on the meaning of the Yuescript code at first, then look into the Lua code if you wish to know the implementation details. +In these examples, the generated Lua code may appear overwhelming. It is best to focus on the meaning of the YueScript code at first, then look into the Lua code if you wish to know the implementation details. A simple class: @@ -3409,7 +3409,7 @@ print var -- nil here -Yuescript’s **do** can also be used an expression . Allowing you to combine multiple lines into one. The result of the do expression is the last statement in its body. +YueScript’s **do** can also be used an expression . Allowing you to combine multiple lines into one. The result of the do expression is the last statement in its body. ```moonscript counter = do @@ -3591,7 +3591,7 @@ print i, k -- these have been updated -## The Yuescript Library +## The YueScript Library Access it by `require("yue")`. @@ -3599,7 +3599,7 @@ Access it by `require("yue")`. **Description:** -The Yuescript language library. +The YueScript language library. #### version @@ -3607,7 +3607,7 @@ The Yuescript language library. **Description:** -The Yuescript version. +The YueScript version. **Signature:** ```lua @@ -3646,7 +3646,7 @@ yue_compiled: {string: string} **Description:** -The Yuescript compiling function. It compiles the Yuescript code to Lua code. +The YueScript compiling function. It compiles the YueScript code to Lua code. **Signature:** ```lua @@ -3660,7 +3660,7 @@ to_lua: function(code: string, config?: Config): | Parameter | Type | Description | | --- | --- | --- | -| code | string | The Yuescript code. | +| code | string | The YueScript code. | | config | Config | [Optional] The compiler options. | **Returns:** @@ -3727,7 +3727,7 @@ read_file: function(filename: string): string **Description:** -Insert the Yuescript loader to the package loaders (searchers). +Insert the YueScript loader to the package loaders (searchers). **Signature:** ```lua @@ -3752,7 +3752,7 @@ insert_loader: function(pos?: integer): boolean **Description:** -Remove the Yuescript loader from the package loaders (searchers). +Remove the YueScript loader from the package loaders (searchers). **Signature:** ```lua @@ -3771,7 +3771,7 @@ remove_loader: function(): boolean **Description:** -Loads Yuescript code from a string into a function. +Loads YueScript code from a string into a function. **Signature:** ```lua @@ -3784,7 +3784,7 @@ loadstring: function(input: string, chunkname: string, env: table, config?: Conf | Parameter | Type | Description | | --- | --- | --- | -| input | string | The Yuescript code. | +| input | string | The YueScript code. | | chunkname | string | The name of the code chunk. | | env | table | The environment table. | | config | Config | [Optional] The compiler options. | @@ -3802,7 +3802,7 @@ loadstring: function(input: string, chunkname: string, env: table, config?: Conf **Description:** -Loads Yuescript code from a string into a function. +Loads YueScript code from a string into a function. **Signature:** ```lua @@ -3815,7 +3815,7 @@ loadstring: function(input: string, chunkname: string, config?: Config): | Parameter | Type | Description | | --- | --- | --- | -| input | string | The Yuescript code. | +| input | string | The YueScript code. | | chunkname | string | The name of the code chunk. | | config | Config | [Optional] The compiler options. | @@ -3832,7 +3832,7 @@ loadstring: function(input: string, chunkname: string, config?: Config): **Description:** -Loads Yuescript code from a string into a function. +Loads YueScript code from a string into a function. **Signature:** ```lua @@ -3845,7 +3845,7 @@ loadstring: function(input: string, config?: Config): | Parameter | Type | Description | | --- | --- | --- | -| input | string | The Yuescript code. | +| input | string | The YueScript code. | | config | Config | [Optional] The compiler options. | **Returns:** @@ -3861,7 +3861,7 @@ loadstring: function(input: string, config?: Config): **Description:** -Loads Yuescript code from a file into a function. +Loads YueScript code from a file into a function. **Signature:** ```lua @@ -3891,7 +3891,7 @@ loadfile: function(filename: string, env: table, config?: Config): **Description:** -Loads Yuescript code from a file into a function. +Loads YueScript code from a file into a function. **Signature:** ```lua @@ -3920,7 +3920,7 @@ loadfile: function(filename: string, config?: Config): **Description:** -Loads Yuescript code from a file into a function and executes it. +Loads YueScript code from a file into a function and executes it. **Signature:** ```lua @@ -3947,7 +3947,7 @@ dofile: function(filename: string, env: table, config?: Config): any... **Description:** -Loads Yuescript code from a file into a function and executes it. +Loads YueScript code from a file into a function and executes it. **Signature:** ```lua @@ -3973,7 +3973,7 @@ dofile: function(filename: string, config?: Config): any... **Description:** -Resolves the Yuescript module name to the file path. +Resolves the YueScript module name to the file path. **Signature:** ```lua @@ -4000,7 +4000,7 @@ find_modulepath: function(name: string): string Calls a function in protected mode. Catches any errors and returns a status code and results or error object. -Rewrites the error line number to the original line number in the Yuescript code when errors occur. +Rewrites the error line number to the original line number in the YueScript code when errors occur. **Signature:** ```lua @@ -4026,8 +4026,8 @@ pcall: function(f: function, ...: any): boolean, any... **Description:** -Loads a given module. Can be either a Lua module or a Yuescript module. -Rewrites the error line number to the original line number in the Yuescript code if the module is a Yuescript module and loading fails. +Loads a given module. Can be either a Lua module or a YueScript module. +Rewrites the error line number to the original line number in the YueScript code if the module is a YueScript module and loading fails. **Signature:** ```lua @@ -4084,7 +4084,7 @@ options: Config.Options **Description:** -The traceback function that rewrites the stack trace line numbers to the original line numbers in the Yuescript code. +The traceback function that rewrites the stack trace line numbers to the original line numbers in the YueScript code. **Signature:** ```lua @@ -4178,8 +4178,8 @@ to_ast: function(code: string, flattenLevel?: number, astName?: string): **Description:** -Requires the Yuescript module. -Rewrites the error line number to the original line number in the Yuescript code when loading fails. +Requires the YueScript module. +Rewrites the error line number to the original line number in the YueScript code when loading fails. **Signature:** ```lua diff --git a/doc/docs/try/README.md b/doc/docs/try/README.md index d6ba5dd..e931f96 100755 --- a/doc/docs/try/README.md +++ b/doc/docs/try/README.md @@ -1,6 +1,6 @@ -# Yuescript Online Compiler +# YueScript Online Compiler --- -Try Yuescript in the browser with WASM. +Try YueScript in the browser with WASM. diff --git a/doc/docs/zh/doc/README.md b/doc/docs/zh/doc/README.md index c9233f6..355e468 100755 --- a/doc/docs/zh/doc/README.md +++ b/doc/docs/zh/doc/README.md @@ -9,7 +9,7 @@ title: 参考手册 ## 介绍 -月之脚本(Yuescript)是一种动态语言,可以编译为Lua。它是[Moonscript](https://github.com/leafo/moonscript)的方言。用月之脚本编写的代码既有表现力又非常简洁。它适合编写一些更易于维护的代码,并在嵌入 Lua 的环境中运行,如游戏或网站服务器。 +月之脚本(YueScript)是一种动态语言,可以编译为Lua。它是[MoonScript](https://github.com/leafo/moonscript)的方言。用月之脚本编写的代码既有表现力又非常简洁。它适合编写一些更易于维护的代码,并在嵌入 Lua 的环境中运行,如游戏或网站服务器。 Yue(月)是中文中“月亮”的名称。 @@ -3602,7 +3602,7 @@ yue_compiled: {string: string} **描述:** -月之脚本的编译函数。它将 Yuescript 代码编译为 Lua 代码。 +月之脚本的编译函数。它将 YueScript 代码编译为 Lua 代码。 **签名:** ```lua @@ -3616,7 +3616,7 @@ to_lua: function(code: string, config?: Config): | 参数名 | 类型 | 描述 | | --- | --- | --- | -| code | string | Yuescript 代码。 | +| code | string | YueScript 代码。 | | config | Config | [可选] 编译器选项。 | **返回值:** @@ -3683,7 +3683,7 @@ read_file: function(filename: string): string **描述:** -将 Yuescript 加载器插入到 Lua 包加载器(搜索器)中。 +将 YueScript 加载器插入到 Lua 包加载器(搜索器)中。 **签名:** ```lua @@ -3708,7 +3708,7 @@ insert_loader: function(pos?: integer): boolean **描述:** -从 Lua 包加载器(搜索器)中移除 Yuescript 加载器。 +从 Lua 包加载器(搜索器)中移除 YueScript 加载器。 **签名:** ```lua @@ -3727,7 +3727,7 @@ remove_loader: function(): boolean **描述:** -将 Yuescript 代码字符串加载为一个函数。 +将 YueScript 代码字符串加载为一个函数。 **签名:** ```lua @@ -3740,7 +3740,7 @@ loadstring: function(input: string, chunkname: string, env: table, config?: Conf | 参数名 | 类型 | 描述 | | --- | --- | --- | -| input | string | Yuescript 代码。 | +| input | string | YueScript 代码。 | | chunkname | string | 代码块的名称。 | | env | table | 环境表。 | | config | Config | [可选] 编译器选项。 | @@ -3758,7 +3758,7 @@ loadstring: function(input: string, chunkname: string, env: table, config?: Conf **描述:** -将 Yuescript 代码字符串加载为一个函数。 +将 YueScript 代码字符串加载为一个函数。 **签名:** ```lua @@ -3771,7 +3771,7 @@ loadstring: function(input: string, chunkname: string, config?: Config): | 参数名 | 类型 | 描述 | | --- | --- | --- | -| input | string | Yuescript 代码。 | +| input | string | YueScript 代码。 | | chunkname | string | 代码块的名称。 | | config | Config | [可选] 编译器选项。 | @@ -3788,7 +3788,7 @@ loadstring: function(input: string, chunkname: string, config?: Config): **描述:** -将 Yuescript 代码字符串加载为一个函数。 +将 YueScript 代码字符串加载为一个函数。 **签名:** ```lua @@ -3801,7 +3801,7 @@ loadstring: function(input: string, config?: Config): | 参数名 | 类型 | 描述 | | --- | --- | --- | -| input | string | Yuescript 代码。 | +| input | string | YueScript 代码。 | | config | Config | [可选] 编译器选项。 | **返回值:** @@ -3817,7 +3817,7 @@ loadstring: function(input: string, config?: Config): **描述:** -将 Yuescript 代码文件加载为一个函数。 +将 YueScript 代码文件加载为一个函数。 **签名:** ```lua @@ -3847,7 +3847,7 @@ loadfile: function(filename: string, env: table, config?: Config): **描述:** -将 Yuescript 代码文件加载为一个函数。 +将 YueScript 代码文件加载为一个函数。 **签名:** ```lua @@ -3876,7 +3876,7 @@ loadfile: function(filename: string, config?: Config): **描述:** -将 Yuescript 代码文件加载为一个函数并执行。 +将 YueScript 代码文件加载为一个函数并执行。 **签名:** ```lua @@ -3903,7 +3903,7 @@ dofile: function(filename: string, env: table, config?: Config): any... **描述:** -将 Yuescript 代码文件加载为一个函数并执行。 +将 YueScript 代码文件加载为一个函数并执行。 **签名:** ```lua @@ -3929,7 +3929,7 @@ dofile: function(filename: string, config?: Config): any... **描述:** -将 Yuescript 模块名解析为文件路径。 +将 YueScript 模块名解析为文件路径。 **签名:** ```lua @@ -3956,7 +3956,7 @@ find_modulepath: function(name: string): string 在保护模式下调用一个函数。 会捕获任何错误,执行成功则返回成功状态和结果,否则为失败状态和错误信息。 -当发生错误时,将错误信息中的代码行号重写为 Yuescript 代码中的原始行号。 +当发生错误时,将错误信息中的代码行号重写为 YueScript 代码中的原始行号。 **签名:** ```lua @@ -3982,8 +3982,8 @@ pcall: function(f: function, ...: any): boolean, any... **描述:** -加载给定的模块。可以是 Lua 模块或 Yuescript 模块。 -如果模块是 Yuescript 模块且加载失败,则将错误信息中的代码行号重写为 Yuescript 代码中的原始行号。 +加载给定的模块。可以是 Lua 模块或 YueScript 模块。 +如果模块是 YueScript 模块且加载失败,则将错误信息中的代码行号重写为 YueScript 代码中的原始行号。 **签名:** ```lua @@ -4040,7 +4040,7 @@ options: Config.Options **描述:** -重写堆栈跟踪中的行号为 Yuescript 代码中的原始行号的 traceback 函数。 +重写堆栈跟踪中的行号为 YueScript 代码中的原始行号的 traceback 函数。 **签名:** ```lua @@ -4126,8 +4126,8 @@ to_ast: function(code: string, flattenLevel?: number, astName?: string): **描述:** -导入 Yuescript 模块。 -如果发生加载失败,则将错误信息中的代码行号重写为 Yuescript 代码中的原始行号。 +导入 YueScript 模块。 +如果发生加载失败,则将错误信息中的代码行号重写为 YueScript 代码中的原始行号。 **签名:** ```lua diff --git a/doc/docs/zh/try/README.md b/doc/docs/zh/try/README.md index c42e5a9..46667a8 100755 --- a/doc/docs/zh/try/README.md +++ b/doc/docs/zh/try/README.md @@ -1,6 +1,6 @@ # 月之脚本的在线编译器 --- -在这里试试 WASM 版的 Yuescript 吧。 +在这里试试 WASM 版的 YueScript 吧。 -- cgit v1.2.3-55-g6feb