diff options
Diffstat (limited to '')
-rwxr-xr-x | doc/docs/doc/README.md | 63 |
1 files changed, 42 insertions, 21 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: { } |