diff options
Diffstat (limited to 'doc/docs')
| -rwxr-xr-x | doc/docs/doc/README.md | 63 | ||||
| -rwxr-xr-x | doc/docs/zh/doc/README.md | 64 |
2 files changed, 84 insertions, 43 deletions
diff --git a/doc/docs/doc/README.md b/doc/docs/doc/README.md index 0853391..58b37c0 100755 --- a/doc/docs/doc/README.md +++ b/doc/docs/doc/README.md | |||
| @@ -16,17 +16,17 @@ Yue (月) is the name of moon in Chinese and it's pronounced as [jyɛ]. | |||
| 16 | ### An Overview of YueScript | 16 | ### An Overview of YueScript |
| 17 | ```moonscript | 17 | ```moonscript |
| 18 | -- import syntax | 18 | -- import syntax |
| 19 | import "yue" as :p, :to_lua | 19 | import p, to_lua from "yue" |
| 20 | 20 | ||
| 21 | -- object literals | 21 | -- object literals |
| 22 | inventory = | 22 | inventory = |
| 23 | equipment: | 23 | equipment: |
| 24 | * "sword" | 24 | - "sword" |
| 25 | * "shield" | 25 | - "shield" |
| 26 | items: | 26 | items: |
| 27 | * name: "potion" | 27 | - name: "potion" |
| 28 | count: 10 | 28 | count: 10 |
| 29 | * name: "bread" | 29 | - name: "bread" |
| 30 | count: 3 | 30 | count: 3 |
| 31 | 31 | ||
| 32 | -- list comprehension | 32 | -- list comprehension |
| @@ -61,17 +61,17 @@ export 🌛 = "月之脚本" | |||
| 61 | <YueDisplay> | 61 | <YueDisplay> |
| 62 | <pre> | 62 | <pre> |
| 63 | -- import syntax | 63 | -- import syntax |
| 64 | import "yue" as :p, :to_lua | 64 | import p, to_lua from "yue" |
| 65 | 65 | ||
| 66 | -- object literals | 66 | -- object literals |
| 67 | inventory = | 67 | inventory = |
| 68 | equipment: | 68 | equipment: |
| 69 | * "sword" | 69 | - "sword" |
| 70 | * "shield" | 70 | - "shield" |
| 71 | items: | 71 | items: |
| 72 | * name: "potion" | 72 | - name: "potion" |
| 73 | count: 10 | 73 | count: 10 |
| 74 | * name: "bread" | 74 | - name: "bread" |
| 75 | count: 3 | 75 | count: 3 |
| 76 | 76 | ||
| 77 | -- list comprehension | 77 | -- list comprehension |
| @@ -752,34 +752,45 @@ a ??= false | |||
| 752 | 752 | ||
| 753 | ### Implicit Object | 753 | ### Implicit Object |
| 754 | 754 | ||
| 755 | You can write a list of implicit structures that starts with the symbol **\*** inside a table block. If you are creating implicit object, the fields of the object must be with the same indent. | 755 | You can write a list of implicit structures that starts with the symbol **\*** or **-** inside a table block. If you are creating implicit object, the fields of the object must be with the same indent. |
| 756 | |||
| 756 | ```moonscript | 757 | ```moonscript |
| 758 | -- assignment with implicit object | ||
| 757 | list = | 759 | list = |
| 758 | * 1 | 760 | * 1 |
| 759 | * 2 | 761 | * 2 |
| 760 | * 3 | 762 | * 3 |
| 761 | 763 | ||
| 764 | -- function call with implicit object | ||
| 762 | func | 765 | func |
| 763 | * 1 | 766 | * 1 |
| 764 | * 2 | 767 | * 2 |
| 765 | * 3 | 768 | * 3 |
| 766 | 769 | ||
| 770 | -- return with implicit object | ||
| 771 | f = -> | ||
| 772 | return | ||
| 773 | * 1 | ||
| 774 | * 2 | ||
| 775 | * 3 | ||
| 776 | |||
| 777 | -- table with implicit object | ||
| 767 | tb = | 778 | tb = |
| 768 | name: "abc" | 779 | name: "abc" |
| 769 | 780 | ||
| 770 | values: | 781 | values: |
| 771 | * "a" | 782 | - "a" |
| 772 | * "b" | 783 | - "b" |
| 773 | * "c" | 784 | - "c" |
| 774 | 785 | ||
| 775 | objects: | 786 | objects: |
| 776 | * name: "a" | 787 | - name: "a" |
| 777 | value: 1 | 788 | value: 1 |
| 778 | func: => @value + 1 | 789 | func: => @value + 1 |
| 779 | tb: | 790 | tb: |
| 780 | fieldA: 1 | 791 | fieldA: 1 |
| 781 | 792 | ||
| 782 | * name: "b" | 793 | - name: "b" |
| 783 | value: 2 | 794 | value: 2 |
| 784 | func: => @value + 2 | 795 | func: => @value + 2 |
| 785 | tb: { } | 796 | tb: { } |
| @@ -787,32 +798,42 @@ tb = | |||
| 787 | ``` | 798 | ``` |
| 788 | <YueDisplay> | 799 | <YueDisplay> |
| 789 | <pre> | 800 | <pre> |
| 801 | -- assignment with implicit object | ||
| 790 | list = | 802 | list = |
| 791 | * 1 | 803 | * 1 |
| 792 | * 2 | 804 | * 2 |
| 793 | * 3 | 805 | * 3 |
| 794 | 806 | ||
| 807 | -- function call with implicit object | ||
| 795 | func | 808 | func |
| 796 | * 1 | 809 | * 1 |
| 797 | * 2 | 810 | * 2 |
| 798 | * 3 | 811 | * 3 |
| 799 | 812 | ||
| 813 | -- return with implicit object | ||
| 814 | f = -> | ||
| 815 | return | ||
| 816 | * 1 | ||
| 817 | * 2 | ||
| 818 | * 3 | ||
| 819 | |||
| 820 | -- table with implicit object | ||
| 800 | tb = | 821 | tb = |
| 801 | name: "abc" | 822 | name: "abc" |
| 802 | 823 | ||
| 803 | values: | 824 | values: |
| 804 | * "a" | 825 | - "a" |
| 805 | * "b" | 826 | - "b" |
| 806 | * "c" | 827 | - "c" |
| 807 | 828 | ||
| 808 | objects: | 829 | objects: |
| 809 | * name: "a" | 830 | - name: "a" |
| 810 | value: 1 | 831 | value: 1 |
| 811 | func: => @value + 1 | 832 | func: => @value + 1 |
| 812 | tb: | 833 | tb: |
| 813 | fieldA: 1 | 834 | fieldA: 1 |
| 814 | 835 | ||
| 815 | * name: "b" | 836 | - name: "b" |
| 816 | value: 2 | 837 | value: 2 |
| 817 | func: => @value + 2 | 838 | func: => @value + 2 |
| 818 | tb: { } | 839 | tb: { } |
diff --git a/doc/docs/zh/doc/README.md b/doc/docs/zh/doc/README.md index 2968f6e..1dd59a7 100755 --- a/doc/docs/zh/doc/README.md +++ b/doc/docs/zh/doc/README.md | |||
| @@ -16,17 +16,17 @@ Yue(月)是中文中“月亮”的名称。 | |||
| 16 | ### 月之脚本概览 | 16 | ### 月之脚本概览 |
| 17 | ```moonscript | 17 | ```moonscript |
| 18 | -- 导入语法 | 18 | -- 导入语法 |
| 19 | import "yue" as :p, :to_lua | 19 | import p, to_lua from "yue" |
| 20 | 20 | ||
| 21 | -- 隐式对象 | 21 | -- 隐式对象 |
| 22 | inventory = | 22 | inventory = |
| 23 | equipment: | 23 | equipment: |
| 24 | * "sword" | 24 | - "sword" |
| 25 | * "shield" | 25 | - "shield" |
| 26 | items: | 26 | items: |
| 27 | * name: "potion" | 27 | - name: "potion" |
| 28 | count: 10 | 28 | count: 10 |
| 29 | * name: "bread" | 29 | - name: "bread" |
| 30 | count: 3 | 30 | count: 3 |
| 31 | 31 | ||
| 32 | -- 列表推导 | 32 | -- 列表推导 |
| @@ -61,17 +61,17 @@ export 🌛 = "月之脚本" | |||
| 61 | <YueDisplay> | 61 | <YueDisplay> |
| 62 | <pre> | 62 | <pre> |
| 63 | -- 导入语法 | 63 | -- 导入语法 |
| 64 | import "yue" as :p, :to_lua | 64 | import p, to_lua from "yue" |
| 65 | 65 | ||
| 66 | -- 隐式对象 | 66 | -- 隐式对象 |
| 67 | inventory = | 67 | inventory = |
| 68 | equipment: | 68 | equipment: |
| 69 | * "sword" | 69 | - "sword" |
| 70 | * "shield" | 70 | - "shield" |
| 71 | items: | 71 | items: |
| 72 | * name: "potion" | 72 | - name: "potion" |
| 73 | count: 10 | 73 | count: 10 |
| 74 | * name: "bread" | 74 | - name: "bread" |
| 75 | count: 3 | 75 | count: 3 |
| 76 | 76 | ||
| 77 | -- 列表推导 | 77 | -- 列表推导 |
| @@ -751,67 +751,87 @@ a ??= false | |||
| 751 | 751 | ||
| 752 | ### 隐式对象 | 752 | ### 隐式对象 |
| 753 | 753 | ||
| 754 | 你可以在表格块内使用符号 **\*** 开始编写一系列隐式结构。如果你正在创建隐式对象,对象的字段必须具有相同的缩进。 | 754 | 你可以在表格块内使用符号 **\*** 或是 **-** 开始编写一系列隐式结构。如果你正在创建隐式对象,对象的字段必须具有相同的缩进。 |
| 755 | |||
| 755 | ```moonscript | 756 | ```moonscript |
| 757 | -- 赋值时使用隐式对象 | ||
| 756 | list = | 758 | list = |
| 757 | * 1 | 759 | * 1 |
| 758 | * 2 | 760 | * 2 |
| 759 | * 3 | 761 | * 3 |
| 760 | 762 | ||
| 763 | -- 函数调用时使用隐式对象 | ||
| 761 | func | 764 | func |
| 762 | * 1 | 765 | * 1 |
| 763 | * 2 | 766 | * 2 |
| 764 | * 3 | 767 | * 3 |
| 765 | 768 | ||
| 769 | -- 返回时使用隐式对象 | ||
| 770 | f = -> | ||
| 771 | return | ||
| 772 | * 1 | ||
| 773 | * 2 | ||
| 774 | * 3 | ||
| 775 | |||
| 776 | -- 表格时使用隐式对象 | ||
| 766 | tb = | 777 | tb = |
| 767 | name: "abc" | 778 | name: "abc" |
| 768 | 779 | ||
| 769 | values: | 780 | values: |
| 770 | * "a" | 781 | - "a" |
| 771 | * "b" | 782 | - "b" |
| 772 | * "c" | 783 | - "c" |
| 773 | 784 | ||
| 774 | objects: | 785 | objects: |
| 775 | * name: "a" | 786 | - name: "a" |
| 776 | value: 1 | 787 | value: 1 |
| 777 | func: => @value + 1 | 788 | func: => @value + 1 |
| 778 | tb: | 789 | tb: |
| 779 | fieldA: 1 | 790 | fieldA: 1 |
| 780 | 791 | ||
| 781 | * name: "b" | 792 | - name: "b" |
| 782 | value: 2 | 793 | value: 2 |
| 783 | func: => @value + 2 | 794 | func: => @value + 2 |
| 784 | tb: { } | 795 | tb: { } |
| 785 | |||
| 786 | ``` | 796 | ``` |
| 787 | <YueDisplay> | 797 | <YueDisplay> |
| 788 | <pre> | 798 | <pre> |
| 799 | -- 赋值时使用隐式对象 | ||
| 789 | list = | 800 | list = |
| 790 | * 1 | 801 | * 1 |
| 791 | * 2 | 802 | * 2 |
| 792 | * 3 | 803 | * 3 |
| 793 | 804 | ||
| 805 | -- 函数调用时使用隐式对象 | ||
| 794 | func | 806 | func |
| 795 | * 1 | 807 | * 1 |
| 796 | * 2 | 808 | * 2 |
| 797 | * 3 | 809 | * 3 |
| 798 | 810 | ||
| 811 | -- 返回时使用隐式对象 | ||
| 812 | f = -> | ||
| 813 | return | ||
| 814 | * 1 | ||
| 815 | * 2 | ||
| 816 | * 3 | ||
| 817 | |||
| 818 | -- 表格时使用隐式对象 | ||
| 799 | tb = | 819 | tb = |
| 800 | name: "abc" | 820 | name: "abc" |
| 801 | 821 | ||
| 802 | values: | 822 | values: |
| 803 | * "a" | 823 | - "a" |
| 804 | * "b" | 824 | - "b" |
| 805 | * "c" | 825 | - "c" |
| 806 | 826 | ||
| 807 | objects: | 827 | objects: |
| 808 | * name: "a" | 828 | - name: "a" |
| 809 | value: 1 | 829 | value: 1 |
| 810 | func: => @value + 1 | 830 | func: => @value + 1 |
| 811 | tb: | 831 | tb: |
| 812 | fieldA: 1 | 832 | fieldA: 1 |
| 813 | 833 | ||
| 814 | * name: "b" | 834 | - name: "b" |
| 815 | value: 2 | 835 | value: 2 |
| 816 | func: => @value + 2 | 836 | func: => @value + 2 |
| 817 | tb: { } | 837 | tb: { } |
