From 0edc328ef9fc89928022fb1c99fb8a73a27eeb41 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 25 Jan 2024 04:20:46 +0000 Subject: [PATCH] Update from https://github.com/WhirlScript/Docs/commit/ff9fcd18a7db4a3c7e2e35e81fee4b26466d21d2 --- 404.html | 2 +- ... guide_getting-started_getting-started.md.Wyl_7s9B.js} | 2 +- ...e_getting-started_getting-started.md.Wyl_7s9B.lean.js} | 2 +- ...uide_getting-started_grammar-and-types.md.5-gI5qS1.js} | 4 ++-- ...getting-started_grammar-and-types.md.5-gI5qS1.lean.js} | 2 +- assets/index.md.hviVOZ0w.js | 1 + assets/index.md.hviVOZ0w.lean.js | 1 + assets/index.md.ksyKq5xW.js | 1 - assets/index.md.ksyKq5xW.lean.js | 1 - ..._guide_getting-started_getting-started.md.aJvtcvjp.js} | 2 +- ...e_getting-started_getting-started.md.aJvtcvjp.lean.js} | 0 ...uide_getting-started_grammar-and-types.md.ze8e6QEw.js} | 2 +- ...getting-started_grammar-and-types.md.ze8e6QEw.lean.js} | 0 ....js => zh_guide_getting-started_struct.md.9DzBf6_a.js} | 2 +- ...> zh_guide_getting-started_struct.md.9DzBf6_a.lean.js} | 0 assets/zh_index.md.DG7l5PHU.js | 1 - assets/zh_index.md.DG7l5PHU.lean.js | 1 - assets/zh_index.md.IXefFD9I.js | 1 + assets/zh_index.md.IXefFD9I.lean.js | 1 + guide/getting-started/control-flow.html | 2 +- guide/getting-started/expressions-and-operators.html | 2 +- guide/getting-started/function.html | 2 +- guide/getting-started/getting-started.html | 6 +++--- guide/getting-started/grammar-and-types.html | 6 +++--- guide/getting-started/hello-whirlpool.html | 2 +- guide/getting-started/hello-world.html | 2 +- guide/getting-started/modules.html | 2 +- guide/getting-started/namespace.html | 2 +- guide/introduction/what-is-whirlscript.html | 2 +- hashmap.json | 2 +- index.html | 8 ++++---- zh/guide/getting-started/annotation.html | 2 +- zh/guide/getting-started/control-flow.html | 2 +- zh/guide/getting-started/expressions-and-operators.html | 2 +- zh/guide/getting-started/function.html | 2 +- zh/guide/getting-started/getting-started.html | 6 +++--- zh/guide/getting-started/grammar-and-types.html | 6 +++--- zh/guide/getting-started/hello-whirlpool.html | 2 +- zh/guide/getting-started/hello-world.html | 2 +- zh/guide/getting-started/modules.html | 2 +- zh/guide/getting-started/namespace.html | 2 +- zh/guide/getting-started/struct.html | 6 +++--- zh/guide/getting-started/target-specify.html | 2 +- zh/guide/introduction/what-is-whirlscript.html | 2 +- zh/index.html | 8 ++++---- zh/reference/std/print.html | 2 +- 46 files changed, 56 insertions(+), 56 deletions(-) rename assets/{guide_getting-started_getting-started.md.a-AqAXy4.js => guide_getting-started_getting-started.md.Wyl_7s9B.js} (94%) rename assets/{guide_getting-started_getting-started.md.a-AqAXy4.lean.js => guide_getting-started_getting-started.md.Wyl_7s9B.lean.js} (81%) rename assets/{guide_getting-started_grammar-and-types.md.jmach5ZJ.js => guide_getting-started_grammar-and-types.md.5-gI5qS1.js} (96%) rename assets/{guide_getting-started_grammar-and-types.md.jmach5ZJ.lean.js => guide_getting-started_grammar-and-types.md.5-gI5qS1.lean.js} (80%) create mode 100644 assets/index.md.hviVOZ0w.js create mode 100644 assets/index.md.hviVOZ0w.lean.js delete mode 100644 assets/index.md.ksyKq5xW.js delete mode 100644 assets/index.md.ksyKq5xW.lean.js rename assets/{zh_guide_getting-started_getting-started.md.C_dUZkIU.js => zh_guide_getting-started_getting-started.md.aJvtcvjp.js} (95%) rename assets/{zh_guide_getting-started_getting-started.md.C_dUZkIU.lean.js => zh_guide_getting-started_getting-started.md.aJvtcvjp.lean.js} (100%) rename assets/{zh_guide_getting-started_grammar-and-types.md.k53aM7vB.js => zh_guide_getting-started_grammar-and-types.md.ze8e6QEw.js} (97%) rename assets/{zh_guide_getting-started_grammar-and-types.md.k53aM7vB.lean.js => zh_guide_getting-started_grammar-and-types.md.ze8e6QEw.lean.js} (100%) rename assets/{zh_guide_getting-started_struct.md.kfMsI81C.js => zh_guide_getting-started_struct.md.9DzBf6_a.js} (96%) rename assets/{zh_guide_getting-started_struct.md.kfMsI81C.lean.js => zh_guide_getting-started_struct.md.9DzBf6_a.lean.js} (100%) delete mode 100644 assets/zh_index.md.DG7l5PHU.js delete mode 100644 assets/zh_index.md.DG7l5PHU.lean.js create mode 100644 assets/zh_index.md.IXefFD9I.js create mode 100644 assets/zh_index.md.IXefFD9I.lean.js diff --git a/404.html b/404.html index 7f2a1ec..77d3080 100644 --- a/404.html +++ b/404.html @@ -19,7 +19,7 @@
Skip to content

404

PAGE NOT FOUND

But if you don't change your direction, and if you keep looking, you may end up where you are heading.

Released under the MIT License.

- + \ No newline at end of file diff --git a/assets/guide_getting-started_getting-started.md.a-AqAXy4.js b/assets/guide_getting-started_getting-started.md.Wyl_7s9B.js similarity index 94% rename from assets/guide_getting-started_getting-started.md.a-AqAXy4.js rename to assets/guide_getting-started_getting-started.md.Wyl_7s9B.js index e05f034..eee4b3a 100644 --- a/assets/guide_getting-started_getting-started.md.a-AqAXy4.js +++ b/assets/guide_getting-started_getting-started.md.Wyl_7s9B.js @@ -1 +1 @@ -import{_ as s,o as a,c as e,Q as l}from"./chunks/framework.jBbNkKut.js";const u=JSON.parse('{"title":"Getting Started","description":"","frontmatter":{"prev":{"text":"What is WhirlScript?","link":"/guide/introduction/what-is-whirlscript"},"next":{"text":"Hello World!","link":"/guide/getting-started/hello-world"}},"headers":[],"relativePath":"guide/getting-started/getting-started.md","filePath":"guide/getting-started/getting-started.md"}'),t={name:"guide/getting-started/getting-started.md"},o=l('

Getting Started

Installation

Prerequisites

sh
$ npm add -g whirlscript
$ npm add -g whirlscript
sh
$ pnpm add -g whirlscript
$ pnpm add -g whirlscript
sh
$ yarn global add whirlscript
$ yarn global add whirlscript

Setup Guide

WhirlScript uses its package manager WhirlPKG.

shell
$ wrp init
$ wrp init

Configuration Files

Compilation

Once you have completed your configuration, you can compile your source code like this:

shell
$ wrsc
$ wrsc
',13),n=[o];function p(r,i,c,d,h,g){return a(),e("div",null,n)}const E=s(t,[["render",p]]);export{u as __pageData,E as default}; +import{_ as s,o as a,c as e,Q as l}from"./chunks/framework.jBbNkKut.js";const y=JSON.parse('{"title":"Getting Started","description":"","frontmatter":{"prev":{"text":"What is WhirlScript?","link":"/guide/introduction/what-is-whirlscript"},"next":{"text":"Hello World!","link":"/guide/getting-started/hello-world"}},"headers":[],"relativePath":"guide/getting-started/getting-started.md","filePath":"guide/getting-started/getting-started.md"}'),t={name:"guide/getting-started/getting-started.md"},o=l('

Getting Started

Installation

Prerequisites

sh
$ npm add -g whirlscript
$ npm add -g whirlscript
sh
$ pnpm add -g whirlscript
$ pnpm add -g whirlscript
sh
$ yarn global add whirlscript
$ yarn global add whirlscript

Setup Guide

WhirlScript uses its package manager WhirlPKG.

shell
$ wrp init
$ wrp init

Configuration Files

Compilation

Once you have completed your configuration, you can compile your source code like this:

shell
$ wrsc
$ wrsc
',13),n=[o];function p(r,i,c,d,h,g){return a(),e("div",null,n)}const E=s(t,[["render",p]]);export{y as __pageData,E as default}; diff --git a/assets/guide_getting-started_getting-started.md.a-AqAXy4.lean.js b/assets/guide_getting-started_getting-started.md.Wyl_7s9B.lean.js similarity index 81% rename from assets/guide_getting-started_getting-started.md.a-AqAXy4.lean.js rename to assets/guide_getting-started_getting-started.md.Wyl_7s9B.lean.js index 430b52b..67ece29 100644 --- a/assets/guide_getting-started_getting-started.md.a-AqAXy4.lean.js +++ b/assets/guide_getting-started_getting-started.md.Wyl_7s9B.lean.js @@ -1 +1 @@ -import{_ as s,o as a,c as e,Q as l}from"./chunks/framework.jBbNkKut.js";const u=JSON.parse('{"title":"Getting Started","description":"","frontmatter":{"prev":{"text":"What is WhirlScript?","link":"/guide/introduction/what-is-whirlscript"},"next":{"text":"Hello World!","link":"/guide/getting-started/hello-world"}},"headers":[],"relativePath":"guide/getting-started/getting-started.md","filePath":"guide/getting-started/getting-started.md"}'),t={name:"guide/getting-started/getting-started.md"},o=l("",13),n=[o];function p(r,i,c,d,h,g){return a(),e("div",null,n)}const E=s(t,[["render",p]]);export{u as __pageData,E as default}; +import{_ as s,o as a,c as e,Q as l}from"./chunks/framework.jBbNkKut.js";const y=JSON.parse('{"title":"Getting Started","description":"","frontmatter":{"prev":{"text":"What is WhirlScript?","link":"/guide/introduction/what-is-whirlscript"},"next":{"text":"Hello World!","link":"/guide/getting-started/hello-world"}},"headers":[],"relativePath":"guide/getting-started/getting-started.md","filePath":"guide/getting-started/getting-started.md"}'),t={name:"guide/getting-started/getting-started.md"},o=l("",13),n=[o];function p(r,i,c,d,h,g){return a(),e("div",null,n)}const E=s(t,[["render",p]]);export{y as __pageData,E as default}; diff --git a/assets/guide_getting-started_grammar-and-types.md.jmach5ZJ.js b/assets/guide_getting-started_grammar-and-types.md.5-gI5qS1.js similarity index 96% rename from assets/guide_getting-started_grammar-and-types.md.jmach5ZJ.js rename to assets/guide_getting-started_grammar-and-types.md.5-gI5qS1.js index 398d413..2a6aa7c 100644 --- a/assets/guide_getting-started_grammar-and-types.md.jmach5ZJ.js +++ b/assets/guide_getting-started_grammar-and-types.md.5-gI5qS1.js @@ -6,7 +6,7 @@ import{_ as a,o as e,c as s,Q as n}from"./chunks/framework.jBbNkKut.js";const v= /* This is a multi-line comment. - */

These will be skipped during the code compilation process. However, if you enable withComment in the compilation options, these comments will be included in the output.

Declarations

There are four states of quantities in WhirlScript:

Runtime quantities can be declared with keywords var and const:

WhirlScript
var v: int = 1;
var v: int = 1;
WhirlScript
const v: int = 1;
const v: int = 1;

For compile-time quantities, you need to add keyword macro.

WhirlScript
macro var v: int = 1;
macro var v: int = 1;
WhirlScript
macro const v: int = 1;
macro const v: int = 1;

Variables

In applications, variables are used as symbolic names for values. The name of a variable is called an identifier, which needs to follow certain rules.

A WhirlScript identifier must start with a letter; subsequent characters can also be numbers (0-9). Because the JavaScript language is case-sensitive, letters can be uppercase letters from "A" to "Z" and lowercase letters from "a" to "z".

Like other languages, most operators cannot be included in the name. What's different is that these symbols, which other languages might allow, are also not allowed:

Why?

Since the identifier of variables in shell is the $ symbol, you cannot use it as a name.

The _ symbol is used to identify scopes and other internal uses, so it cannot be used as a name either.

Note that these two symbols will be parsed as ordinary operators.

At the same time, the behavior of using keywords as identifiers is undefined.

Examples of legal identifiers: NumberHits, temp99.

Declaring Variables

You can declare a variable in this way:

whirlscript
var num: int = 1;
var num: int = 1;

Where var indicates that a runtime variable is declared, num is the identifier of the variable, : int indicates that the variable type is int, and = 1 initializes this variable to a value (here it is 1).

If initialization is included, the variable type is optional (inferred by the compiler).

In some cases, you must specify the type to get the result you want:

whirlscript
var aNum: int = 1;
+ */

These will be skipped during the code compilation process. However, if you enable withComment in the compilation options, these comments will be included in the output.

Declarations

There are four states of quantities in WhirlScript:

Runtime quantities can be declared with keywords var and const:

WhirlScript
var v: int = 1;
var v: int = 1;
WhirlScript
const v: int = 1;
const v: int = 1;

For compile-time quantities, you need to add keyword macro.

WhirlScript
macro var v: int = 1;
macro var v: int = 1;
WhirlScript
macro const v: int = 1;
macro const v: int = 1;

Variables

In applications, variables are used as symbolic names for values. The name of a variable is called an identifier, which needs to follow certain rules.

A WhirlScript identifier must start with a letter; subsequent characters can also be numbers (0-9). Because the JavaScript language is case-sensitive, letters can be uppercase letters from "A" to "Z" and lowercase letters from "a" to "z".

Like other languages, most operators cannot be included in the name. What's different is that these symbols, which other languages might allow, are also not allowed:

Why?

Since the identifier of variables in shell is the $ symbol, you cannot use it as a name.

The _ symbol is used to identify scopes and other internal uses, so it cannot be used as a name either.

Note that these two symbols will be parsed as ordinary operators.

At the same time, the behavior of using keywords as identifiers is undefined.

Examples of legal identifiers: NumberHits, temp99.

Declaring Variables

You can declare a variable in this way:

whirlscript
var num: int = 1;
var num: int = 1;

Where var indicates that a runtime variable is declared, num is the identifier of the variable, : int indicates that the variable type is int, and = 1 initializes this variable to a value (here it is 1).

If initialization is included, the variable type is optional (inferred by the compiler).

In some cases, you must specify the type to get the result you want:

whirlscript
var aNum: int = 1;
 var aString: string = aNum;  // Get "1".
var aNum: int = 1;
 var aString: string = aNum;  // Get "1".

This will be mentioned in Conversion of Data Types.

For all variables (including compile-time and runtime variables), initialization is optional.

Variable Evaluation

For variables declared with the var statement, if no initial value is assigned, accessing its value will get a default value. The default value is different depending on the type.

Accessing an undeclared variable will cause an error.

Final Variables

You can use the @final annotation to declare a final quantity or a function:

whirlscript
@final var g: string = "This is a final variable"; // Declare a final variable
 
@@ -38,4 +38,4 @@ import{_ as a,o as e,c as s,Q as n}from"./chunks/framework.jBbNkKut.js";const v=
 n = "string";   // Error!
var n: int = 12;
 n = "string";   // Error!

Implicit Conversion

In this case, there will be no error:

whirlscript
var s: string = "string";
 s = 12;
var s: string = "string";
-s = 12;

Here an implicit conversion has occurred. There are three situations for implicit conversion, respectively:

Even if you directly call it in raw statements, it will be the same.

Why?

In the underlying implementation, all quantities are strings.

The underlying implementation of Boolean values is "0" and "1".

The underlying implementation of integers is the corresponding string.

Type Assertion

Implicit conversion can only be upward conversion.

If you need to convert in reverse, you need type assertion. The premise is that you are very sure that this is convertible.

Type assertion is marked with <>, for example:

whirlscript
var n: int = <int>"123";
var n: int = <int>"123";

The compiler will not check whether your conversion is legal. Please use it cautiously.

Literals

In WhirlScript, you can use various literals. These literals are fixed values given in the script literally, not variables.

For example 1, true, "str".

`,72),l=[i];function o(r,c,p,d,u,h){return e(),s("div",null,l)}const g=a(t,[["render",o]]);export{v as __pageData,g as default}; +s = 12;

Here an implicit conversion has occurred. There are three situations for implicit conversion, respectively:

Even if you directly call it in raw statements, it will be the same.

Why?

In the underlying implementation, all quantities are strings.

The underlying implementation of Boolean values is "0" and "1".

The underlying implementation of integers is the corresponding string.

Type Assertion

Implicit conversion can only be upward conversion.

If you need to convert in reverse, you need type assertion. The premise is that you are very sure that this is convertible.

Type assertion is marked with <>, for example:

whirlscript
var n: int = <int>"123";
var n: int = <int>"123";

The compiler will not check whether your conversion is legal. Please use it cautiously.

Literals

In WhirlScript, you can use various literals. These literals are fixed values given in the script literally, not variables.

For example 1, true, "str".

`,72),o=[i];function l(r,c,p,d,u,h){return e(),s("div",null,o)}const g=a(t,[["render",l]]);export{v as __pageData,g as default}; diff --git a/assets/guide_getting-started_grammar-and-types.md.jmach5ZJ.lean.js b/assets/guide_getting-started_grammar-and-types.md.5-gI5qS1.lean.js similarity index 80% rename from assets/guide_getting-started_grammar-and-types.md.jmach5ZJ.lean.js rename to assets/guide_getting-started_grammar-and-types.md.5-gI5qS1.lean.js index a42cf97..96cf65a 100644 --- a/assets/guide_getting-started_grammar-and-types.md.jmach5ZJ.lean.js +++ b/assets/guide_getting-started_grammar-and-types.md.5-gI5qS1.lean.js @@ -1 +1 @@ -import{_ as a,o as e,c as s,Q as n}from"./chunks/framework.jBbNkKut.js";const v=JSON.parse('{"title":"Grammar and Data Types","description":"","frontmatter":{"prev":{"text":"Hello WhirlPKG!","link":"/guide/getting-started/hello-whirlpkg"},"next":{"text":"Control Flow","link":"/guide/getting-started/control-flow"}},"headers":[],"relativePath":"guide/getting-started/grammar-and-types.md","filePath":"guide/getting-started/grammar-and-types.md"}'),t={name:"guide/getting-started/grammar-and-types.md"},i=n("",72),l=[i];function o(r,c,p,d,u,h){return e(),s("div",null,l)}const g=a(t,[["render",o]]);export{v as __pageData,g as default}; +import{_ as a,o as e,c as s,Q as n}from"./chunks/framework.jBbNkKut.js";const v=JSON.parse('{"title":"Grammar and Data Types","description":"","frontmatter":{"prev":{"text":"Hello WhirlPKG!","link":"/guide/getting-started/hello-whirlpkg"},"next":{"text":"Control Flow","link":"/guide/getting-started/control-flow"}},"headers":[],"relativePath":"guide/getting-started/grammar-and-types.md","filePath":"guide/getting-started/grammar-and-types.md"}'),t={name:"guide/getting-started/grammar-and-types.md"},i=n("",72),o=[i];function l(r,c,p,d,u,h){return e(),s("div",null,o)}const g=a(t,[["render",l]]);export{v as __pageData,g as default}; diff --git a/assets/index.md.hviVOZ0w.js b/assets/index.md.hviVOZ0w.js new file mode 100644 index 0000000..083c4bf --- /dev/null +++ b/assets/index.md.hviVOZ0w.js @@ -0,0 +1 @@ +import{_ as t,o as e,c as i}from"./chunks/framework.jBbNkKut.js";const f=JSON.parse(`{"title":"Whirlscript","titleTemplate":"A next generation script language","description":"","frontmatter":{"layout":"home","title":"Whirlscript","titleTemplate":"A next generation script language","hero":{"name":"Whirlscript","text":"Next generation\\nLanguage for script\\n","tagline":"Write readable and maintainable codes,\\ncompiles to clean bat and sh scripts.\\n","actions":[{"theme":"brand","text":"Get Started","link":"/guide/getting-started/getting-started"},{"theme":"alt","text":"View on GitHub","link":"https://github.com/Bluemangoo/WhirlScript"}],"image":{"src":"/logo-large.svg","alt":"WhirlScript"}},"features":[{"icon":"📝","title":"Focus on Your Logic","details":"Less effort on struggling with native script syntax."},{"icon":"#","title":"Precompile","details":"Write macro to process your logic on compiling."},{"icon":"\\n","title":"Cross Compiling","details":"Write one code, compiles to all platform's script."},{"icon":"📦","title":"Work with Package Manager","details":"Work together with WhirlPKG packages. It's easy to find and get wheels."}]},"headers":[],"relativePath":"index.md","filePath":"index.md"}`),a={name:"index.md"};function l(n,r,o,s,Q,c){return e(),i("div")}const d=t(a,[["render",l]]);export{f as __pageData,d as default}; diff --git a/assets/index.md.hviVOZ0w.lean.js b/assets/index.md.hviVOZ0w.lean.js new file mode 100644 index 0000000..083c4bf --- /dev/null +++ b/assets/index.md.hviVOZ0w.lean.js @@ -0,0 +1 @@ +import{_ as t,o as e,c as i}from"./chunks/framework.jBbNkKut.js";const f=JSON.parse(`{"title":"Whirlscript","titleTemplate":"A next generation script language","description":"","frontmatter":{"layout":"home","title":"Whirlscript","titleTemplate":"A next generation script language","hero":{"name":"Whirlscript","text":"Next generation\\nLanguage for script\\n","tagline":"Write readable and maintainable codes,\\ncompiles to clean bat and sh scripts.\\n","actions":[{"theme":"brand","text":"Get Started","link":"/guide/getting-started/getting-started"},{"theme":"alt","text":"View on GitHub","link":"https://github.com/Bluemangoo/WhirlScript"}],"image":{"src":"/logo-large.svg","alt":"WhirlScript"}},"features":[{"icon":"📝","title":"Focus on Your Logic","details":"Less effort on struggling with native script syntax."},{"icon":"#","title":"Precompile","details":"Write macro to process your logic on compiling."},{"icon":"\\n","title":"Cross Compiling","details":"Write one code, compiles to all platform's script."},{"icon":"📦","title":"Work with Package Manager","details":"Work together with WhirlPKG packages. It's easy to find and get wheels."}]},"headers":[],"relativePath":"index.md","filePath":"index.md"}`),a={name:"index.md"};function l(n,r,o,s,Q,c){return e(),i("div")}const d=t(a,[["render",l]]);export{f as __pageData,d as default}; diff --git a/assets/index.md.ksyKq5xW.js b/assets/index.md.ksyKq5xW.js deleted file mode 100644 index b146c87..0000000 --- a/assets/index.md.ksyKq5xW.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as t,o as e,c as i}from"./chunks/framework.jBbNkKut.js";const d=JSON.parse(`{"title":"Whirlscript","titleTemplate":"A next generation script language","description":"","frontmatter":{"layout":"home","title":"Whirlscript","titleTemplate":"A next generation script language","hero":{"name":"Whirlscript","text":"A next generation\\nscript language\\n","tagline":"Write readable and maintainable codes,\\ncompiles to clean bat and sh scripts.\\n","actions":[{"theme":"brand","text":"Get Started","link":"/guide/getting-started/getting-started"},{"theme":"alt","text":"View on GitHub","link":"https://github.com/Bluemangoo/WhirlScript"}],"image":{"src":"/logo-large.svg","alt":"WhirlScript"}},"features":[{"icon":"📝","title":"Focus on Your Logic","details":"Less effort on struggling with native script syntax."},{"icon":"#","title":"Precompile","details":"Write macro to process your logic on compiling."},{"icon":"\\n","title":"Cross Compiling","details":"Write one code, compiles to all platform's script."},{"icon":"📦","title":"Work with Package Manager","details":"Work together with WhirlPKG packages. It's easy to find and get wheels."}]},"headers":[],"relativePath":"index.md","filePath":"index.md"}`),a={name:"index.md"};function l(n,r,o,s,Q,c){return e(),i("div")}const f=t(a,[["render",l]]);export{d as __pageData,f as default}; diff --git a/assets/index.md.ksyKq5xW.lean.js b/assets/index.md.ksyKq5xW.lean.js deleted file mode 100644 index b146c87..0000000 --- a/assets/index.md.ksyKq5xW.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as t,o as e,c as i}from"./chunks/framework.jBbNkKut.js";const d=JSON.parse(`{"title":"Whirlscript","titleTemplate":"A next generation script language","description":"","frontmatter":{"layout":"home","title":"Whirlscript","titleTemplate":"A next generation script language","hero":{"name":"Whirlscript","text":"A next generation\\nscript language\\n","tagline":"Write readable and maintainable codes,\\ncompiles to clean bat and sh scripts.\\n","actions":[{"theme":"brand","text":"Get Started","link":"/guide/getting-started/getting-started"},{"theme":"alt","text":"View on GitHub","link":"https://github.com/Bluemangoo/WhirlScript"}],"image":{"src":"/logo-large.svg","alt":"WhirlScript"}},"features":[{"icon":"📝","title":"Focus on Your Logic","details":"Less effort on struggling with native script syntax."},{"icon":"#","title":"Precompile","details":"Write macro to process your logic on compiling."},{"icon":"\\n","title":"Cross Compiling","details":"Write one code, compiles to all platform's script."},{"icon":"📦","title":"Work with Package Manager","details":"Work together with WhirlPKG packages. It's easy to find and get wheels."}]},"headers":[],"relativePath":"index.md","filePath":"index.md"}`),a={name:"index.md"};function l(n,r,o,s,Q,c){return e(),i("div")}const f=t(a,[["render",l]]);export{d as __pageData,f as default}; diff --git a/assets/zh_guide_getting-started_getting-started.md.C_dUZkIU.js b/assets/zh_guide_getting-started_getting-started.md.aJvtcvjp.js similarity index 95% rename from assets/zh_guide_getting-started_getting-started.md.C_dUZkIU.js rename to assets/zh_guide_getting-started_getting-started.md.aJvtcvjp.js index c6383c6..0693d04 100644 --- a/assets/zh_guide_getting-started_getting-started.md.C_dUZkIU.js +++ b/assets/zh_guide_getting-started_getting-started.md.aJvtcvjp.js @@ -1 +1 @@ -import{_ as s,o as a,c as l,Q as e}from"./chunks/framework.jBbNkKut.js";const g=JSON.parse('{"title":"立即开始","description":"","frontmatter":{"prev":{"text":"什么是 WhirlScript?","link":"/zh/guide/introduction/what-is-whirlscript"},"next":{"text":"Hello World!","link":"/zh/guide/getting-started/hello-world"}},"headers":[],"relativePath":"zh/guide/getting-started/getting-started.md","filePath":"zh/guide/getting-started/getting-started.md"}'),n={name:"zh/guide/getting-started/getting-started.md"},o=e('

立即开始

安装

先决条件

sh
$ npm add -g whirlscript
$ npm add -g whirlscript
sh
$ pnpm add -g whirlscript
$ pnpm add -g whirlscript
sh
$ yarn global add whirlscript
$ yarn global add whirlscript

设置向导

WhirlScript 使用其包管理器 WhirlPool

shell
$ wrp init
$ wrp init

配置文件

编译

只要完成了配置,就可以像下面这样编译你的源代码:

shell
$ wrsc
$ wrsc
',13),p=[o];function t(r,c,i,d,h,y){return a(),l("div",null,p)}const u=s(n,[["render",t]]);export{g as __pageData,u as default}; +import{_ as s,o as a,c as l,Q as e}from"./chunks/framework.jBbNkKut.js";const g=JSON.parse('{"title":"立即开始","description":"","frontmatter":{"prev":{"text":"什么是 WhirlScript?","link":"/zh/guide/introduction/what-is-whirlscript"},"next":{"text":"Hello World!","link":"/zh/guide/getting-started/hello-world"}},"headers":[],"relativePath":"zh/guide/getting-started/getting-started.md","filePath":"zh/guide/getting-started/getting-started.md"}'),n={name:"zh/guide/getting-started/getting-started.md"},o=e('

立即开始

安装

先决条件

sh
$ npm add -g whirlscript
$ npm add -g whirlscript
sh
$ pnpm add -g whirlscript
$ pnpm add -g whirlscript
sh
$ yarn global add whirlscript
$ yarn global add whirlscript

设置向导

WhirlScript 使用其包管理器 WhirlPool

shell
$ wrp init
$ wrp init

配置文件

编译

只要完成了配置,就可以像下面这样编译你的源代码:

shell
$ wrsc
$ wrsc
',13),p=[o];function t(r,c,i,d,h,y){return a(),l("div",null,p)}const u=s(n,[["render",t]]);export{g as __pageData,u as default}; diff --git a/assets/zh_guide_getting-started_getting-started.md.C_dUZkIU.lean.js b/assets/zh_guide_getting-started_getting-started.md.aJvtcvjp.lean.js similarity index 100% rename from assets/zh_guide_getting-started_getting-started.md.C_dUZkIU.lean.js rename to assets/zh_guide_getting-started_getting-started.md.aJvtcvjp.lean.js diff --git a/assets/zh_guide_getting-started_grammar-and-types.md.k53aM7vB.js b/assets/zh_guide_getting-started_grammar-and-types.md.ze8e6QEw.js similarity index 97% rename from assets/zh_guide_getting-started_grammar-and-types.md.k53aM7vB.js rename to assets/zh_guide_getting-started_grammar-and-types.md.ze8e6QEw.js index 111cd26..1f806fe 100644 --- a/assets/zh_guide_getting-started_grammar-and-types.md.k53aM7vB.js +++ b/assets/zh_guide_getting-started_grammar-and-types.md.ze8e6QEw.js @@ -6,7 +6,7 @@ import{_ as a,o as s,c as e,Q as l}from"./chunks/framework.jBbNkKut.js";const v= /* 这是 多行注释。 - */

在代码编译的过程中,这些会被跳过。但是如果你在编译选项中启用 withComment,这些注释都会被包含在输出中。

声明

WhirlScript 的量有四种状态:

运行时量可以直接使用关键字 varconst 声明:

WhirlScript
var v: int = 1;
var v: int = 1;
WhirlScript
const v: int = 1;
const v: int = 1;

对于编译期量,则需要添加 macro 关键字。

WhirlScript
macro var v: int = 1;
macro var v: int = 1;
WhirlScript
macro const v: int = 1;
macro const v: int = 1;

变量

在应用程序中,使用变量来作为值的符号名。变量的名字又叫做标识符,其需要遵守一定的规则。

一个 WhirlScript 标识符必须以字母开头;后续的字符也可以是数字(0-9)。因为 JavaScript 语言是区分大小写的,所以字母可以是从“A”到“Z”的大写字母和从“a”到“z”的小写字母。

和其它语言类似,大部分的运算符不能被包含在名称中。不同的是,这几种其它语言可能允许的符号也不被允许:

为什么?

由于 shell 中变量的标识是 $ 符号,你不能将它用作名称。

_ 符号被用作标识作用域和其它内部用途,因此也不能被用作名称。

需要注意的是,这两种符号会被作为普通运算符解析。

同时,使用关键字作为标识符的行为是未定义的。

合法的标识符示例:NumberHitstemp99

声明变量

你可以通过这种方式声明一个变量:

whirlscript
var num: int = 1;
var num: int = 1;

其中,var 标识声明的是一个运行时变量,num 为变量的标识符,: int 标识变量类型为 int= 1 将此变量初始化为一个值(在这里为 1)。

如果包含了初始化,那么变量类型是可省的(由编译器推断)。

在一些情况下,你必须要标明类型才可能得到你想要的结果:

whirlscript
var aNum: int = 1;
+ */

在代码编译的过程中,这些会被跳过。但是如果你在编译选项中启用 withComment,这些注释都会被包含在输出中。

声明

WhirlScript 的量有四种状态:

运行时量可以直接使用关键字 varconst 声明:

WhirlScript
var v: int = 1;
var v: int = 1;
WhirlScript
const v: int = 1;
const v: int = 1;

对于编译期量,则需要添加 macro 关键字。

WhirlScript
macro var v: int = 1;
macro var v: int = 1;
WhirlScript
macro const v: int = 1;
macro const v: int = 1;

变量

在应用程序中,使用变量来作为值的符号名。变量的名字又叫做标识符,其需要遵守一定的规则。

一个 WhirlScript 标识符必须以字母开头;后续的字符也可以是数字(0-9)。因为 JavaScript 语言是区分大小写的,所以字母可以是从“A”到“Z”的大写字母和从“a”到“z”的小写字母。

和其它语言类似,大部分的运算符不能被包含在名称中。不同的是,这几种其它语言可能允许的符号也不被允许:

为什么?

由于 shell 中变量的标识是 $ 符号,你不能将它用作名称。

_ 符号被用作标识作用域和其它内部用途,因此也不能被用作名称。

需要注意的是,这两种符号会被作为普通运算符解析。

同时,使用关键字作为标识符的行为是未定义的。

合法的标识符示例:NumberHitstemp99

声明变量

你可以通过这种方式声明一个变量:

whirlscript
var num: int = 1;
var num: int = 1;

其中,var 标识声明的是一个运行时变量,num 为变量的标识符,: int 标识变量类型为 int= 1 将此变量初始化为一个值(在这里为 1)。

如果包含了初始化,那么变量类型是可省的(由编译器推断)。

在一些情况下,你必须要标明类型才可能得到你想要的结果:

whirlscript
var aNum: int = 1;
 var aString: string = aNum;  // 得到 "1"。
var aNum: int = 1;
 var aString: string = aNum;  // 得到 "1"。

这会在数据类型的转换中提到。

对于所有的变量(包括编译期和运行时变量),初始化是可选的。

变量求值

var 语句声明的变量,如果没有赋初始值,则访问其值会得到默认值。默认值按类型是不同的。

如果访问一个未声明的变量会导致报错。

最终变量

你可以使用 @final 注解声明一个最终量或函数:

⚠️ 警告

你只能将一个运行时量声明为最终量,而不能将编译期量声明为最终量。函数也一样。

注解相关内容详见 注解

whirlscript
@final var g: string = "这是一个最终变量"; // 声明一个最终变量
 
diff --git a/assets/zh_guide_getting-started_grammar-and-types.md.k53aM7vB.lean.js b/assets/zh_guide_getting-started_grammar-and-types.md.ze8e6QEw.lean.js
similarity index 100%
rename from assets/zh_guide_getting-started_grammar-and-types.md.k53aM7vB.lean.js
rename to assets/zh_guide_getting-started_grammar-and-types.md.ze8e6QEw.lean.js
diff --git a/assets/zh_guide_getting-started_struct.md.kfMsI81C.js b/assets/zh_guide_getting-started_struct.md.9DzBf6_a.js
similarity index 96%
rename from assets/zh_guide_getting-started_struct.md.kfMsI81C.js
rename to assets/zh_guide_getting-started_struct.md.9DzBf6_a.js
index bffe5f8..7151f06 100644
--- a/assets/zh_guide_getting-started_struct.md.kfMsI81C.js
+++ b/assets/zh_guide_getting-started_struct.md.9DzBf6_a.js
@@ -4,7 +4,7 @@ import{_ as s,o as a,c as n,Q as e}from"./chunks/framework.jBbNkKut.js";const g=
 }
struct MyStruct {
     number: int,
     used: boolean
-}

结构体不允许出现自我嵌套,包括直接嵌套和间接嵌套。例如,以下的定义是错误的。

WhirlScript
struct MyStruct {
+}

结构体不允许出现自我嵌套,包括直接嵌套和间接嵌套。例如,以下的定义是错误的。

WhirlScript
struct MyStruct {
     id: int,
     next: MyStruct 
 }
struct MyStruct {
diff --git a/assets/zh_guide_getting-started_struct.md.kfMsI81C.lean.js b/assets/zh_guide_getting-started_struct.md.9DzBf6_a.lean.js
similarity index 100%
rename from assets/zh_guide_getting-started_struct.md.kfMsI81C.lean.js
rename to assets/zh_guide_getting-started_struct.md.9DzBf6_a.lean.js
diff --git a/assets/zh_index.md.DG7l5PHU.js b/assets/zh_index.md.DG7l5PHU.js
deleted file mode 100644
index f02a197..0000000
--- a/assets/zh_index.md.DG7l5PHU.js
+++ /dev/null
@@ -1 +0,0 @@
-import{_ as t,o as e,c as i}from"./chunks/framework.jBbNkKut.js";const h=JSON.parse('{"title":"Whirlscript","titleTemplate":"下一代脚本语言","description":"","frontmatter":{"layout":"home","title":"Whirlscript","titleTemplate":"下一代脚本语言","hero":{"name":"Whirlscript","text":"下一代\\n脚本语言\\n","tagline":"可读、可维护的代码,\\n编译为干净的 bat 和 sh 脚本。\\n","actions":[{"theme":"brand","text":"立即开始","link":"/zh/guide/getting-started/getting-started"},{"theme":"alt","text":"在 GitHub 上查看","link":"https://github.com/Bluemangoo/WhirlScript"}],"image":{"src":"/logo-large.svg","alt":"WhirlScript"}},"features":[{"icon":"📝","title":"专注于逻辑","details":"减少花在原生脚本语言糟糕语法上的功夫。"},{"icon":"#","title":"预编译处理","details":"编写宏内容来预处理脚本。"},{"icon":"\\n","title":"交叉编译","details":"只需写一份代码,即可编译为全平台的脚本。"},{"icon":"📦","title":"包管理器支持","details":"支持 WhirlPKG 包。可以更轻松地找到和使用已有的轮子。"}]},"headers":[],"relativePath":"zh/index.md","filePath":"zh/index.md"}'),Q={name:"zh/index.md"};function l(a,n,r,f,s,d){return e(),i("div")}const c=t(Q,[["render",l]]);export{h as __pageData,c as default};
diff --git a/assets/zh_index.md.DG7l5PHU.lean.js b/assets/zh_index.md.DG7l5PHU.lean.js
deleted file mode 100644
index f02a197..0000000
--- a/assets/zh_index.md.DG7l5PHU.lean.js
+++ /dev/null
@@ -1 +0,0 @@
-import{_ as t,o as e,c as i}from"./chunks/framework.jBbNkKut.js";const h=JSON.parse('{"title":"Whirlscript","titleTemplate":"下一代脚本语言","description":"","frontmatter":{"layout":"home","title":"Whirlscript","titleTemplate":"下一代脚本语言","hero":{"name":"Whirlscript","text":"下一代\\n脚本语言\\n","tagline":"可读、可维护的代码,\\n编译为干净的 bat 和 sh 脚本。\\n","actions":[{"theme":"brand","text":"立即开始","link":"/zh/guide/getting-started/getting-started"},{"theme":"alt","text":"在 GitHub 上查看","link":"https://github.com/Bluemangoo/WhirlScript"}],"image":{"src":"/logo-large.svg","alt":"WhirlScript"}},"features":[{"icon":"📝","title":"专注于逻辑","details":"减少花在原生脚本语言糟糕语法上的功夫。"},{"icon":"#","title":"预编译处理","details":"编写宏内容来预处理脚本。"},{"icon":"\\n","title":"交叉编译","details":"只需写一份代码,即可编译为全平台的脚本。"},{"icon":"📦","title":"包管理器支持","details":"支持 WhirlPKG 包。可以更轻松地找到和使用已有的轮子。"}]},"headers":[],"relativePath":"zh/index.md","filePath":"zh/index.md"}'),Q={name:"zh/index.md"};function l(a,n,r,f,s,d){return e(),i("div")}const c=t(Q,[["render",l]]);export{h as __pageData,c as default};
diff --git a/assets/zh_index.md.IXefFD9I.js b/assets/zh_index.md.IXefFD9I.js
new file mode 100644
index 0000000..41034a8
--- /dev/null
+++ b/assets/zh_index.md.IXefFD9I.js
@@ -0,0 +1 @@
+import{_ as t,o as e,c as i}from"./chunks/framework.jBbNkKut.js";const h=JSON.parse('{"title":"Whirlscript","titleTemplate":"下一代脚本语言","description":"","frontmatter":{"layout":"home","title":"Whirlscript","titleTemplate":"下一代脚本语言","hero":{"name":"Whirlscript","text":"下一代语言\\n为脚本而生\\n","tagline":"可读、可维护的代码,\\n编译为干净的 bat 和 sh 脚本。\\n","actions":[{"theme":"brand","text":"立即开始","link":"/zh/guide/getting-started/getting-started"},{"theme":"alt","text":"在 GitHub 上查看","link":"https://github.com/Bluemangoo/WhirlScript"}],"image":{"src":"/logo-large.svg","alt":"WhirlScript"}},"features":[{"icon":"📝","title":"专注于逻辑","details":"减少花在原生脚本语言糟糕语法上的功夫。"},{"icon":"#","title":"预编译处理","details":"编写宏内容来预处理脚本。"},{"icon":"\\n","title":"交叉编译","details":"只需写一份代码,即可编译为全平台的脚本。"},{"icon":"📦","title":"包管理器支持","details":"支持 WhirlPKG 包。可以更轻松地找到和使用已有的轮子。"}]},"headers":[],"relativePath":"zh/index.md","filePath":"zh/index.md"}'),Q={name:"zh/index.md"};function l(a,n,r,f,s,d){return e(),i("div")}const c=t(Q,[["render",l]]);export{h as __pageData,c as default};
diff --git a/assets/zh_index.md.IXefFD9I.lean.js b/assets/zh_index.md.IXefFD9I.lean.js
new file mode 100644
index 0000000..41034a8
--- /dev/null
+++ b/assets/zh_index.md.IXefFD9I.lean.js
@@ -0,0 +1 @@
+import{_ as t,o as e,c as i}from"./chunks/framework.jBbNkKut.js";const h=JSON.parse('{"title":"Whirlscript","titleTemplate":"下一代脚本语言","description":"","frontmatter":{"layout":"home","title":"Whirlscript","titleTemplate":"下一代脚本语言","hero":{"name":"Whirlscript","text":"下一代语言\\n为脚本而生\\n","tagline":"可读、可维护的代码,\\n编译为干净的 bat 和 sh 脚本。\\n","actions":[{"theme":"brand","text":"立即开始","link":"/zh/guide/getting-started/getting-started"},{"theme":"alt","text":"在 GitHub 上查看","link":"https://github.com/Bluemangoo/WhirlScript"}],"image":{"src":"/logo-large.svg","alt":"WhirlScript"}},"features":[{"icon":"📝","title":"专注于逻辑","details":"减少花在原生脚本语言糟糕语法上的功夫。"},{"icon":"#","title":"预编译处理","details":"编写宏内容来预处理脚本。"},{"icon":"\\n","title":"交叉编译","details":"只需写一份代码,即可编译为全平台的脚本。"},{"icon":"📦","title":"包管理器支持","details":"支持 WhirlPKG 包。可以更轻松地找到和使用已有的轮子。"}]},"headers":[],"relativePath":"zh/index.md","filePath":"zh/index.md"}'),Q={name:"zh/index.md"};function l(a,n,r,f,s,d){return e(),i("div")}const c=t(Q,[["render",l]]);export{h as __pageData,c as default};
diff --git a/guide/getting-started/control-flow.html b/guide/getting-started/control-flow.html
index 5172f15..553eced 100644
--- a/guide/getting-started/control-flow.html
+++ b/guide/getting-started/control-flow.html
@@ -46,7 +46,7 @@
 } else {
   statement_last;
 }

To execute multiple statements, you can use a statement block ({ ... }) to group these statements. Generally, always using statement blocks is a good habit, especially when the code involves more if statements.

- + \ No newline at end of file diff --git a/guide/getting-started/expressions-and-operators.html b/guide/getting-started/expressions-and-operators.html index 9f0d645..3ebce38 100644 --- a/guide/getting-started/expressions-and-operators.html +++ b/guide/getting-started/expressions-and-operators.html @@ -70,7 +70,7 @@ // This is equivalent to a * c + b * c; // 9

Lvalue Expressions

Lvalues can be the target of assignment.

- + \ No newline at end of file diff --git a/guide/getting-started/function.html b/guide/getting-started/function.html index 13902b9..60e9276 100644 --- a/guide/getting-started/function.html +++ b/guide/getting-started/function.html @@ -80,7 +80,7 @@ var x = 1; succ(x); println(x); //Outputs 2.

Recursive Limitations

Except for constant functions, macro functions cannot use recursion.

Native Function

With keyword native, macro function can be declared as a native function.

Declaring a native function does not require a function body. It should be noted that a semicolon is required at the end of the sentence.

WhirlScript
native macro function fn();
native macro function fn();
- + \ No newline at end of file diff --git a/guide/getting-started/getting-started.html b/guide/getting-started/getting-started.html index 54eba9c..97ba899 100644 --- a/guide/getting-started/getting-started.html +++ b/guide/getting-started/getting-started.html @@ -11,7 +11,7 @@ - + @@ -21,8 +21,8 @@ -
Skip to content

Getting Started

Installation

Prerequisites

  • Node.js version 18 or higher.
  • A terminal for accessing WhirlScript through its Command Line Interface (CLI).
sh
$ npm add -g whirlscript
$ npm add -g whirlscript
sh
$ pnpm add -g whirlscript
$ pnpm add -g whirlscript
sh
$ yarn global add whirlscript
$ yarn global add whirlscript

Setup Guide

WhirlScript uses its package manager WhirlPKG.

shell
$ wrp init
$ wrp init

Configuration Files

  • The whirlpkg.json file is used to store the package configuration;
  • The wrsconfig.json file is used to store the build configuration.

Compilation

Once you have completed your configuration, you can compile your source code like this:

shell
$ wrsc
$ wrsc

Released under the MIT License.

- +
Skip to content

Getting Started

Installation

Prerequisites

  • Node.js version 18 or higher.
  • A terminal for accessing WhirlScript through its Command Line Interface (CLI).
sh
$ npm add -g whirlscript
$ npm add -g whirlscript
sh
$ pnpm add -g whirlscript
$ pnpm add -g whirlscript
sh
$ yarn global add whirlscript
$ yarn global add whirlscript

Setup Guide

WhirlScript uses its package manager WhirlPKG.

shell
$ wrp init
$ wrp init

Configuration Files

  • The whirlpkg.json file is used to store the package configuration;
  • The wrsconfig.json file is used to store the build configuration.

Compilation

Once you have completed your configuration, you can compile your source code like this:

shell
$ wrsc
$ wrsc

Released under the MIT License.

+ \ No newline at end of file diff --git a/guide/getting-started/grammar-and-types.html b/guide/getting-started/grammar-and-types.html index 7e39b33..e4f5fcf 100644 --- a/guide/getting-started/grammar-and-types.html +++ b/guide/getting-started/grammar-and-types.html @@ -11,7 +11,7 @@ - + @@ -29,7 +29,7 @@ /* This is a multi-line comment. - */

These will be skipped during the code compilation process. However, if you enable withComment in the compilation options, these comments will be included in the output.

Declarations

There are four states of quantities in WhirlScript:

Runtime quantities can be declared with keywords var and const:

WhirlScript
var v: int = 1;
var v: int = 1;
WhirlScript
const v: int = 1;
const v: int = 1;

For compile-time quantities, you need to add keyword macro.

WhirlScript
macro var v: int = 1;
macro var v: int = 1;
WhirlScript
macro const v: int = 1;
macro const v: int = 1;

Variables

In applications, variables are used as symbolic names for values. The name of a variable is called an identifier, which needs to follow certain rules.

A WhirlScript identifier must start with a letter; subsequent characters can also be numbers (0-9). Because the JavaScript language is case-sensitive, letters can be uppercase letters from "A" to "Z" and lowercase letters from "a" to "z".

Like other languages, most operators cannot be included in the name. What's different is that these symbols, which other languages might allow, are also not allowed:

Why?

Since the identifier of variables in shell is the $ symbol, you cannot use it as a name.

The _ symbol is used to identify scopes and other internal uses, so it cannot be used as a name either.

Note that these two symbols will be parsed as ordinary operators.

At the same time, the behavior of using keywords as identifiers is undefined.

Examples of legal identifiers: NumberHits, temp99.

Declaring Variables

You can declare a variable in this way:

whirlscript
var num: int = 1;
var num: int = 1;

Where var indicates that a runtime variable is declared, num is the identifier of the variable, : int indicates that the variable type is int, and = 1 initializes this variable to a value (here it is 1).

If initialization is included, the variable type is optional (inferred by the compiler).

In some cases, you must specify the type to get the result you want:

whirlscript
var aNum: int = 1;
+ */

These will be skipped during the code compilation process. However, if you enable withComment in the compilation options, these comments will be included in the output.

Declarations

There are four states of quantities in WhirlScript:

Runtime quantities can be declared with keywords var and const:

WhirlScript
var v: int = 1;
var v: int = 1;
WhirlScript
const v: int = 1;
const v: int = 1;

For compile-time quantities, you need to add keyword macro.

WhirlScript
macro var v: int = 1;
macro var v: int = 1;
WhirlScript
macro const v: int = 1;
macro const v: int = 1;

Variables

In applications, variables are used as symbolic names for values. The name of a variable is called an identifier, which needs to follow certain rules.

A WhirlScript identifier must start with a letter; subsequent characters can also be numbers (0-9). Because the JavaScript language is case-sensitive, letters can be uppercase letters from "A" to "Z" and lowercase letters from "a" to "z".

Like other languages, most operators cannot be included in the name. What's different is that these symbols, which other languages might allow, are also not allowed:

Why?

Since the identifier of variables in shell is the $ symbol, you cannot use it as a name.

The _ symbol is used to identify scopes and other internal uses, so it cannot be used as a name either.

Note that these two symbols will be parsed as ordinary operators.

At the same time, the behavior of using keywords as identifiers is undefined.

Examples of legal identifiers: NumberHits, temp99.

Declaring Variables

You can declare a variable in this way:

whirlscript
var num: int = 1;
var num: int = 1;

Where var indicates that a runtime variable is declared, num is the identifier of the variable, : int indicates that the variable type is int, and = 1 initializes this variable to a value (here it is 1).

If initialization is included, the variable type is optional (inferred by the compiler).

In some cases, you must specify the type to get the result you want:

whirlscript
var aNum: int = 1;
 var aString: string = aNum;  // Get "1".
var aNum: int = 1;
 var aString: string = aNum;  // Get "1".

This will be mentioned in Conversion of Data Types.

For all variables (including compile-time and runtime variables), initialization is optional.

Variable Evaluation

For variables declared with the var statement, if no initial value is assigned, accessing its value will get a default value. The default value is different depending on the type.

Accessing an undeclared variable will cause an error.

Final Variables

You can use the @final annotation to declare a final quantity or a function:

whirlscript
@final var g: string = "This is a final variable"; // Declare a final variable
 
@@ -62,7 +62,7 @@
 n = "string";   // Error!

Implicit Conversion

In this case, there will be no error:

whirlscript
var s: string = "string";
 s = 12;
var s: string = "string";
 s = 12;

Here an implicit conversion has occurred. There are three situations for implicit conversion, respectively:

Even if you directly call it in raw statements, it will be the same.

Why?

In the underlying implementation, all quantities are strings.

The underlying implementation of Boolean values is "0" and "1".

The underlying implementation of integers is the corresponding string.

Type Assertion

Implicit conversion can only be upward conversion.

If you need to convert in reverse, you need type assertion. The premise is that you are very sure that this is convertible.

Type assertion is marked with <>, for example:

whirlscript
var n: int = <int>"123";
var n: int = <int>"123";

The compiler will not check whether your conversion is legal. Please use it cautiously.

Literals

In WhirlScript, you can use various literals. These literals are fixed values given in the script literally, not variables.

For example 1, true, "str".

- + \ No newline at end of file diff --git a/guide/getting-started/hello-whirlpool.html b/guide/getting-started/hello-whirlpool.html index 650f116..b5ad741 100644 --- a/guide/getting-started/hello-whirlpool.html +++ b/guide/getting-started/hello-whirlpool.html @@ -26,7 +26,7 @@ hello();
import "hello";
 
 hello();

Compilation and Running

Compile and run as before!

Do you think it's troublesome to open a new terminal and add a line of command for running? Try the command line parameter -r:

shell
$ wrsc -r
$ wrsc -r

This will automatically run the compiled script after the compilation is completed (only for the corresponding current platform, if the compilation target does not include the current platform, this parameter will not do anything. On the contrary, you will get a warning).

- + \ No newline at end of file diff --git a/guide/getting-started/hello-world.html b/guide/getting-started/hello-world.html index 1dafa26..e6ddb91 100644 --- a/guide/getting-started/hello-world.html +++ b/guide/getting-started/hello-world.html @@ -28,7 +28,7 @@ }

The entrypoint here refers to the main.wrs file we created earlier. If you used a different filename or put it in a folder, please modify it accordingly.

Compile!

The compilation command is very simple. We have written the information that the compiler needs to know in the configuration, so just open the terminal here and enter:

shell
$ wrsc
$ wrsc

The compiled script is located under the build folder in the project directory, you can find it there.

Corresponding to your operating system, you can find hello-world.bat or hello-world.sh.

Next, simply open a terminal and run it!

text
$ ./hello-world
 Hello World!
$ ./hello-world
 Hello World!

Looking at the Hello World! printed on the screen, we have taken a big step forward!

- + \ No newline at end of file diff --git a/guide/getting-started/modules.html b/guide/getting-started/modules.html index 95c409f..c6960e7 100644 --- a/guide/getting-started/modules.html +++ b/guide/getting-started/modules.html @@ -22,7 +22,7 @@
Skip to content

Modules

WhirlScript programs can be broken down into individual modules that are imported as needed. This is also the foundation of its package management.

Tip

It's advisable to place all definitions within namespaces in files that act as modules, to avoid namespace pollution after import.

Importing Modules

Use the import statement to import a module.

WhirlScript
import "./module";
import "./module";

The imported module is actually a .wrs file. You need to use relative paths (starting with ./) to import files in the project directory.

The import statement needs to be at the outermost level. That is, you cannot import a module within functions, branches, and other statements.

Importing is essentially a simple string concatenation. Therefore, all content in the imported file will be parsed as part of this file.

Repeated imports are safe. The second import of the same module will be ignored.

Importing WhirlPKG Packages

WhirlPKG provides a variety of third-party packages. You can install them to the current project with $ wrp add $pkg, and then use the import statement to import:

WhirlScript
import "hello";
import "hello";

For packages that provide optional imports, you can import them in this way:

WhirlScript
import "hello/hello";
import "hello/hello";

Released under the MIT License.

- + \ No newline at end of file diff --git a/guide/getting-started/namespace.html b/guide/getting-started/namespace.html index 57b6d87..1bee48f 100644 --- a/guide/getting-started/namespace.html +++ b/guide/getting-started/namespace.html @@ -106,7 +106,7 @@ } foo::bar::foobar();// foobar - + \ No newline at end of file diff --git a/guide/introduction/what-is-whirlscript.html b/guide/introduction/what-is-whirlscript.html index 2f27977..180ada4 100644 --- a/guide/introduction/what-is-whirlscript.html +++ b/guide/introduction/what-is-whirlscript.html @@ -22,7 +22,7 @@
Skip to content

What is WhirlScript?

WhirlScript is a language that compiles into bat and sh scripts.

Tired of the terrible grammar of native scripts? Try WhirlScript! Just write code in a readable and maintainable way, and we'll take care of the rest.

Released under the MIT License.

- + \ No newline at end of file diff --git a/hashmap.json b/hashmap.json index a00492b..cc016bd 100644 --- a/hashmap.json +++ b/hashmap.json @@ -1 +1 @@ -{"guide_getting-started_control-flow.md":"te0rcWe4","zh_guide_getting-started_target-specify.md":"wNTGuGvy","guide_getting-started_expressions-and-operators.md":"7xb0pMFs","zh_guide_introduction_what-is-whirlscript.md":"z90PDUcZ","zh_guide_getting-started_modules.md":"g9q95ZWo","guide_getting-started_getting-started.md":"a-AqAXy4","zh_guide_getting-started_getting-started.md":"C_dUZkIU","guide_getting-started_hello-world.md":"Fwv4cOgI","index.md":"ksyKq5xW","zh_guide_getting-started_annotation.md":"0haL1fA4","guide_getting-started_namespace.md":"-3CX6yO-","zh_guide_getting-started_control-flow.md":"mFGwp9h0","zh_reference_std_print.md":"19oMjqI3","zh_index.md":"DG7l5PHU","zh_guide_getting-started_struct.md":"kfMsI81C","zh_guide_getting-started_hello-world.md":"J5xz4VMH","zh_guide_getting-started_grammar-and-types.md":"k53aM7vB","guide_getting-started_function.md":"XvkIPmxg","zh_guide_getting-started_hello-whirlpool.md":"9f7KPYQ6","zh_guide_getting-started_namespace.md":"yakHR0BB","guide_getting-started_hello-whirlpool.md":"-arLq62u","guide_getting-started_modules.md":"hbZqeF8Q","zh_guide_getting-started_expressions-and-operators.md":"FZ49Vew8","guide_introduction_what-is-whirlscript.md":"q0W47Ugl","guide_getting-started_grammar-and-types.md":"jmach5ZJ","zh_guide_getting-started_function.md":"i2JKFw47"} +{"guide_introduction_what-is-whirlscript.md":"q0W47Ugl","guide_getting-started_function.md":"XvkIPmxg","zh_guide_getting-started_annotation.md":"0haL1fA4","guide_getting-started_hello-whirlpool.md":"-arLq62u","zh_guide_getting-started_grammar-and-types.md":"ze8e6QEw","guide_getting-started_grammar-and-types.md":"5-gI5qS1","zh_guide_getting-started_expressions-and-operators.md":"FZ49Vew8","zh_guide_getting-started_hello-world.md":"J5xz4VMH","zh_guide_introduction_what-is-whirlscript.md":"z90PDUcZ","zh_guide_getting-started_struct.md":"9DzBf6_a","index.md":"hviVOZ0w","guide_getting-started_hello-world.md":"Fwv4cOgI","zh_guide_getting-started_control-flow.md":"mFGwp9h0","guide_getting-started_control-flow.md":"te0rcWe4","zh_guide_getting-started_hello-whirlpool.md":"9f7KPYQ6","guide_getting-started_getting-started.md":"Wyl_7s9B","guide_getting-started_expressions-and-operators.md":"7xb0pMFs","zh_guide_getting-started_target-specify.md":"wNTGuGvy","zh_guide_getting-started_getting-started.md":"aJvtcvjp","guide_getting-started_modules.md":"hbZqeF8Q","zh_guide_getting-started_function.md":"i2JKFw47","zh_guide_getting-started_modules.md":"g9q95ZWo","zh_index.md":"IXefFD9I","guide_getting-started_namespace.md":"-3CX6yO-","zh_reference_std_print.md":"19oMjqI3","zh_guide_getting-started_namespace.md":"yakHR0BB"} diff --git a/index.html b/index.html index ba4287d..f58d127 100644 --- a/index.html +++ b/index.html @@ -11,7 +11,7 @@ - + @@ -21,13 +21,13 @@ -
Skip to content

Whirlscript

A next generation -script language +

Skip to content

Whirlscript

Next generation +Language for script

Write readable and maintainable codes, compiles to clean bat and sh scripts.

WhirlScript

Released under the MIT License.

- + \ No newline at end of file diff --git a/zh/guide/getting-started/annotation.html b/zh/guide/getting-started/annotation.html index 309e271..39dc384 100644 --- a/zh/guide/getting-started/annotation.html +++ b/zh/guide/getting-started/annotation.html @@ -22,7 +22,7 @@
Skip to content

注解

在这之前,我们已经接触了好几种注解了。

注解是一种特殊注释。更形象的说,注解是给编译器看的注释,它影响着编译器如何处理接下来的语句。

WhirlScript 的注解分为两种,分别是对语句的注解和对声明的注解。

语句注解

现有的语句注解包括这些:

注解含义
@sh接下来的语句或语句块只在编译到 sh 脚本时会被解析
@bat接下来的语句或语句块只在编译到 bat 脚本时会被解析

其中,@sh@bat 的用法详见 目标限定

声明注解

现有的声明注解包括这些:

注解含义
@final接下来声明的量或函数为最终量,名称在编译结果中不会被修改。
@env接下来声明的量为环境变量。需要声明为常量。
@editable接下来声明的量为可编辑变量,编译后将被放在脚本顶端以允许用户编辑。
@optional接下来声明的量为可选量或函数,如果没有被非可选部分代码使用则不会被添加到编译输出中。

Released under the MIT License.

- + \ No newline at end of file diff --git a/zh/guide/getting-started/control-flow.html b/zh/guide/getting-started/control-flow.html index 436daab..afb6edb 100644 --- a/zh/guide/getting-started/control-flow.html +++ b/zh/guide/getting-started/control-flow.html @@ -46,7 +46,7 @@ } else { statement_last; }

要执行多个语句,可以使用语句块 ({ ... }) 来分组这些语句。通常,总是使用语句块是一个好的习惯,特别是在代码涉及比较多的 if 语句时。

- + \ No newline at end of file diff --git a/zh/guide/getting-started/expressions-and-operators.html b/zh/guide/getting-started/expressions-and-operators.html index 817f9a7..1eb1f1a 100644 --- a/zh/guide/getting-started/expressions-and-operators.html +++ b/zh/guide/getting-started/expressions-and-operators.html @@ -70,7 +70,7 @@ // 这等价于 a * c + b * c; // 9

左值表达式

左值可以作为赋值的目标。

- + \ No newline at end of file diff --git a/zh/guide/getting-started/function.html b/zh/guide/getting-started/function.html index a297eb6..d3bf8b8 100644 --- a/zh/guide/getting-started/function.html +++ b/zh/guide/getting-started/function.html @@ -80,7 +80,7 @@ var x = 1; succ(x); println(x); //输出 2。

递归限制

除了常值函数以外,宏函数不能使用递归。

原生函数

宏函数可以通过关键字 native 被声明为原生函数。

声明原生函数不需要函数体。需要注意的是,句末需要加上分号。

WhirlScript
native macro function fn();
native macro function fn();
- + \ No newline at end of file diff --git a/zh/guide/getting-started/getting-started.html b/zh/guide/getting-started/getting-started.html index cb61456..acbce21 100644 --- a/zh/guide/getting-started/getting-started.html +++ b/zh/guide/getting-started/getting-started.html @@ -11,7 +11,7 @@ - + @@ -21,8 +21,8 @@ -
Skip to content

立即开始

安装

先决条件

  • Node.js 版本需为 18 或更高。
  • 用于通过命令行界面(CLI)访问 WhirlScript 的终端。
sh
$ npm add -g whirlscript
$ npm add -g whirlscript
sh
$ pnpm add -g whirlscript
$ pnpm add -g whirlscript
sh
$ yarn global add whirlscript
$ yarn global add whirlscript

设置向导

WhirlScript 使用其包管理器 WhirlPool

shell
$ wrp init
$ wrp init

配置文件

  • 文件 whirlpkg.json 用于存储包的配置;
  • 文件 wrsconfig.json 用于存储构建的配置。

编译

只要完成了配置,就可以像下面这样编译你的源代码:

shell
$ wrsc
$ wrsc

Released under the MIT License.

- +
Skip to content

立即开始

安装

先决条件

  • Node.js 版本需为 18 或更高。
  • 用于通过命令行界面(CLI)访问 WhirlScript 的终端。
sh
$ npm add -g whirlscript
$ npm add -g whirlscript
sh
$ pnpm add -g whirlscript
$ pnpm add -g whirlscript
sh
$ yarn global add whirlscript
$ yarn global add whirlscript

设置向导

WhirlScript 使用其包管理器 WhirlPool

shell
$ wrp init
$ wrp init

配置文件

  • 文件 whirlpkg.json 用于存储包的配置;
  • 文件 wrsconfig.json 用于存储构建的配置。

编译

只要完成了配置,就可以像下面这样编译你的源代码:

shell
$ wrsc
$ wrsc

Released under the MIT License.

+ \ No newline at end of file diff --git a/zh/guide/getting-started/grammar-and-types.html b/zh/guide/getting-started/grammar-and-types.html index 0961ba0..c55e863 100644 --- a/zh/guide/getting-started/grammar-and-types.html +++ b/zh/guide/getting-started/grammar-and-types.html @@ -11,7 +11,7 @@ - + @@ -29,7 +29,7 @@ /* 这是 多行注释。 - */

在代码编译的过程中,这些会被跳过。但是如果你在编译选项中启用 withComment,这些注释都会被包含在输出中。

声明

WhirlScript 的量有四种状态:

运行时量可以直接使用关键字 varconst 声明:

WhirlScript
var v: int = 1;
var v: int = 1;
WhirlScript
const v: int = 1;
const v: int = 1;

对于编译期量,则需要添加 macro 关键字。

WhirlScript
macro var v: int = 1;
macro var v: int = 1;
WhirlScript
macro const v: int = 1;
macro const v: int = 1;

变量

在应用程序中,使用变量来作为值的符号名。变量的名字又叫做标识符,其需要遵守一定的规则。

一个 WhirlScript 标识符必须以字母开头;后续的字符也可以是数字(0-9)。因为 JavaScript 语言是区分大小写的,所以字母可以是从“A”到“Z”的大写字母和从“a”到“z”的小写字母。

和其它语言类似,大部分的运算符不能被包含在名称中。不同的是,这几种其它语言可能允许的符号也不被允许:

为什么?

由于 shell 中变量的标识是 $ 符号,你不能将它用作名称。

_ 符号被用作标识作用域和其它内部用途,因此也不能被用作名称。

需要注意的是,这两种符号会被作为普通运算符解析。

同时,使用关键字作为标识符的行为是未定义的。

合法的标识符示例:NumberHitstemp99

声明变量

你可以通过这种方式声明一个变量:

whirlscript
var num: int = 1;
var num: int = 1;

其中,var 标识声明的是一个运行时变量,num 为变量的标识符,: int 标识变量类型为 int= 1 将此变量初始化为一个值(在这里为 1)。

如果包含了初始化,那么变量类型是可省的(由编译器推断)。

在一些情况下,你必须要标明类型才可能得到你想要的结果:

whirlscript
var aNum: int = 1;
+ */

在代码编译的过程中,这些会被跳过。但是如果你在编译选项中启用 withComment,这些注释都会被包含在输出中。

声明

WhirlScript 的量有四种状态:

运行时量可以直接使用关键字 varconst 声明:

WhirlScript
var v: int = 1;
var v: int = 1;
WhirlScript
const v: int = 1;
const v: int = 1;

对于编译期量,则需要添加 macro 关键字。

WhirlScript
macro var v: int = 1;
macro var v: int = 1;
WhirlScript
macro const v: int = 1;
macro const v: int = 1;

变量

在应用程序中,使用变量来作为值的符号名。变量的名字又叫做标识符,其需要遵守一定的规则。

一个 WhirlScript 标识符必须以字母开头;后续的字符也可以是数字(0-9)。因为 JavaScript 语言是区分大小写的,所以字母可以是从“A”到“Z”的大写字母和从“a”到“z”的小写字母。

和其它语言类似,大部分的运算符不能被包含在名称中。不同的是,这几种其它语言可能允许的符号也不被允许:

为什么?

由于 shell 中变量的标识是 $ 符号,你不能将它用作名称。

_ 符号被用作标识作用域和其它内部用途,因此也不能被用作名称。

需要注意的是,这两种符号会被作为普通运算符解析。

同时,使用关键字作为标识符的行为是未定义的。

合法的标识符示例:NumberHitstemp99

声明变量

你可以通过这种方式声明一个变量:

whirlscript
var num: int = 1;
var num: int = 1;

其中,var 标识声明的是一个运行时变量,num 为变量的标识符,: int 标识变量类型为 int= 1 将此变量初始化为一个值(在这里为 1)。

如果包含了初始化,那么变量类型是可省的(由编译器推断)。

在一些情况下,你必须要标明类型才可能得到你想要的结果:

whirlscript
var aNum: int = 1;
 var aString: string = aNum;  // 得到 "1"。
var aNum: int = 1;
 var aString: string = aNum;  // 得到 "1"。

这会在数据类型的转换中提到。

对于所有的变量(包括编译期和运行时变量),初始化是可选的。

变量求值

var 语句声明的变量,如果没有赋初始值,则访问其值会得到默认值。默认值按类型是不同的。

如果访问一个未声明的变量会导致报错。

最终变量

你可以使用 @final 注解声明一个最终量或函数:

⚠️ 警告

你只能将一个运行时量声明为最终量,而不能将编译期量声明为最终量。函数也一样。

注解相关内容详见 注解

whirlscript
@final var g: string = "这是一个最终变量"; // 声明一个最终变量
 
@@ -54,7 +54,7 @@
 n = "string";   // 报错!

隐式转换

在这种情况下并不会报错:

whirlscript
var s: string = "string";
 s = 12;
var s: string = "string";
 s = 12;

这里发生了隐式转换。隐式转换有三种情况,分别为:

即使在 raw 语句中直接调用,也会这样。

为什么?

在底层实现中,所有量都是字符串。

布尔值的底层实现就是 "0""1"

整数的底层实现就是对应的字符串。

类型断言

隐式转换只能向上转换。

如果你需要反过来转换,则需要类型断言。前提是,你非常确定这是可以转换的。

类型断言使用 <> 来标识,比如:

whirlscript
var n: int = <int>"123";
var n: int = <int>"123";

编译器不会检查你的转换是否合法。请谨慎使用。

字面量

在 WhirlScript 中,你可以使用各种字面量。这些字面量是脚本中按字面意思给出的固定的值,而不是变量。

例如 1true"str"

- + \ No newline at end of file diff --git a/zh/guide/getting-started/hello-whirlpool.html b/zh/guide/getting-started/hello-whirlpool.html index 7cdf2ce..25512d0 100644 --- a/zh/guide/getting-started/hello-whirlpool.html +++ b/zh/guide/getting-started/hello-whirlpool.html @@ -26,7 +26,7 @@ hello();
import "hello";
 
 hello();

编译和运行

像前面一样编译运行吧!

觉得为了运行要新开一个终端多些一行命令很麻烦?试试命令行参数 -r

shell
$ wrsc -r
$ wrsc -r

这会在编译结束后自动运行编译输出的脚本(仅限于当前平台对应的,如果编译目标中不包含当前平台,这个参数不会做任何事。正好相反,你会得到一条警告)。

- + \ No newline at end of file diff --git a/zh/guide/getting-started/hello-world.html b/zh/guide/getting-started/hello-world.html index a0aac05..bf4c9bb 100644 --- a/zh/guide/getting-started/hello-world.html +++ b/zh/guide/getting-started/hello-world.html @@ -28,7 +28,7 @@ }

此处的 entrypoint 指的是我们前面新建的 main.wrs 文件。如果你使用了其它文件名或者放在了文件夹中,请对应修改它。

编译!

编译命令特别简单。我们已经在配置里面写上了编译器需要知道的信息,所以只需要在这里打开终端,输入:

shell
$ wrsc
$ wrsc

编译得到的脚本位于项目目录的 build 文件夹底下,你可以在里面找到它。

对应你的操作系统,你可以找到 hello-world.bathello-world.sh

接下来,简单的打开一个终端,运行它!

text
$ ./hello-world
 Hello World!
$ ./hello-world
 Hello World!

看着屏幕上印出的 Hello World!,我们已经向前了一大步了!

- + \ No newline at end of file diff --git a/zh/guide/getting-started/modules.html b/zh/guide/getting-started/modules.html index 619202e..cc5a921 100644 --- a/zh/guide/getting-started/modules.html +++ b/zh/guide/getting-started/modules.html @@ -22,7 +22,7 @@
Skip to content

模块

WhirlScript 程序可以被拆分为多个按需导入的单独模块。这也是其包管理的前提。

小贴士

建议在作为模块的文件中,将所有定义置于命名空间中,防止导入后污染命名空间。

导入模块

使用 import 语句导入一个模块。

WhirlScript
import "./module";
import "./module";

导入的模块实际上是一个 .wrs 文件。你需要使用相对路径(以 ./ 开头)来导入项目目录中的文件。

导入语句需要在最外层。即,你不能在函数、分支等语句内部导入一个模块。

导入实际上是字符串的简单拼接。因此,导入的文件中的所有内容都会被作为此文件的一部分被解析。

重复导入是安全的。第二次导入同一个模块会被忽略。

导入 Whirl 包

WhirlPKG 提供了各种第三方包。你可以通过 $ wrp add $pkg 安装到当前项目,然后使用 import 语句导入:

WhirlScript
import "hello";
import "hello";

对于提供了可选导入的包,你可以通过这种方式导入:

WhirlScript
import "hello/hello";
import "hello/hello";

Released under the MIT License.

- + \ No newline at end of file diff --git a/zh/guide/getting-started/namespace.html b/zh/guide/getting-started/namespace.html index 96b3a2f..788d056 100644 --- a/zh/guide/getting-started/namespace.html +++ b/zh/guide/getting-started/namespace.html @@ -106,7 +106,7 @@ } foo::bar::foobar();// foobar - + \ No newline at end of file diff --git a/zh/guide/getting-started/struct.html b/zh/guide/getting-started/struct.html index aa34728..fa82605 100644 --- a/zh/guide/getting-started/struct.html +++ b/zh/guide/getting-started/struct.html @@ -11,7 +11,7 @@ - + @@ -27,7 +27,7 @@ }
struct MyStruct {
     number: int,
     used: boolean
-}

结构体不允许出现自我嵌套,包括直接嵌套和间接嵌套。例如,以下的定义是错误的。

WhirlScript
struct MyStruct {
+}

结构体不允许出现自我嵌套,包括直接嵌套和间接嵌套。例如,以下的定义是错误的。

WhirlScript
struct MyStruct {
     id: int,
     next: MyStruct 
 }
struct MyStruct {
@@ -56,7 +56,7 @@
     id: 2,
     used: false
 };

调用

使用 . 来调用结构体内的量:

WhirlScript
println(v.id); // 2
println(v.id); // 2
- + \ No newline at end of file diff --git a/zh/guide/getting-started/target-specify.html b/zh/guide/getting-started/target-specify.html index 79db6a1..6946766 100644 --- a/zh/guide/getting-started/target-specify.html +++ b/zh/guide/getting-started/target-specify.html @@ -34,7 +34,7 @@ @bat { println("BAT only block."); }

注解相关内容详见 注解

- + \ No newline at end of file diff --git a/zh/guide/introduction/what-is-whirlscript.html b/zh/guide/introduction/what-is-whirlscript.html index 9c34fdf..a9934d0 100644 --- a/zh/guide/introduction/what-is-whirlscript.html +++ b/zh/guide/introduction/what-is-whirlscript.html @@ -22,7 +22,7 @@
Skip to content

什么是 WhirlScript?

WhirlScript 是一种编译为 bat 和 sh 脚本的语言。

受够了原生脚本的糟糕语法?试试 WhirlScript!只需要编写可读可维护的代码,剩下的我们会搞定的。

Released under the MIT License.

- + \ No newline at end of file diff --git a/zh/index.html b/zh/index.html index 5bde738..f526679 100644 --- a/zh/index.html +++ b/zh/index.html @@ -11,7 +11,7 @@ - + @@ -21,13 +21,13 @@ -
Skip to content

Whirlscript

下一代 -脚本语言 +

Skip to content

Whirlscript

下一代语言 +为脚本而生

可读、可维护的代码, 编译为干净的 bat 和 sh 脚本。

WhirlScript

Released under the MIT License.

- + \ No newline at end of file diff --git a/zh/reference/std/print.html b/zh/reference/std/print.html index 6f0aec8..de8e099 100644 --- a/zh/reference/std/print.html +++ b/zh/reference/std/print.html @@ -22,7 +22,7 @@
Skip to content

print 函数

print() 用于输出至控制台。其变体 println() 会在输出后加上一个换行。

小贴士

如果不是特别需要,最好使用 println() 而不是 print()

语法

WhirlScript
print("test");// 输出 test
print("test");// 输出 test

参数

x

字符串类型的输出值。

返回值

没有返回值。

Released under the MIT License.

- + \ No newline at end of file