aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/yuescript/LICENSE.md21
-rw-r--r--src/yuescript/yue_ast.h2
-rw-r--r--src/yuescript/yue_compiler.cpp9
-rw-r--r--src/yuescript/yue_parser.cpp2
4 files changed, 31 insertions, 3 deletions
diff --git a/src/yuescript/LICENSE.md b/src/yuescript/LICENSE.md
new file mode 100644
index 0000000..b1a5fee
--- /dev/null
+++ b/src/yuescript/LICENSE.md
@@ -0,0 +1,21 @@
1MIT License
2
3Copyright (c) 2023 Li Jin
4
5Permission is hereby granted, free of charge, to any person obtaining a copy
6of this software and associated documentation files (the "Software"), to deal
7in the Software without restriction, including without limitation the rights
8to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9copies of the Software, and to permit persons to whom the Software is
10furnished to do so, subject to the following conditions:
11
12The above copyright notice and this permission notice shall be included in all
13copies or substantial portions of the Software.
14
15THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21SOFTWARE.
diff --git a/src/yuescript/yue_ast.h b/src/yuescript/yue_ast.h
index 2136849..fa47559 100644
--- a/src/yuescript/yue_ast.h
+++ b/src/yuescript/yue_ast.h
@@ -787,7 +787,7 @@ AST_NODE(Macro)
787AST_END(Macro, "macro"sv) 787AST_END(Macro, "macro"sv)
788 788
789AST_NODE(NameOrDestructure) 789AST_NODE(NameOrDestructure)
790 ast_sel<true, Variable_t, TableLit_t> item; 790 ast_sel<true, Variable_t, TableLit_t, Comprehension_t> item;
791 AST_MEMBER(NameOrDestructure, &item) 791 AST_MEMBER(NameOrDestructure, &item)
792AST_END(NameOrDestructure, "name_or_des"sv) 792AST_END(NameOrDestructure, "name_or_des"sv)
793 793
diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp
index 0265e07..648dab2 100644
--- a/src/yuescript/yue_compiler.cpp
+++ b/src/yuescript/yue_compiler.cpp
@@ -75,7 +75,7 @@ static std::unordered_set<std::string> Metamethods = {
75 "close"s // Lua 5.4 75 "close"s // Lua 5.4
76}; 76};
77 77
78const std::string_view version = "0.20.2"sv; 78const std::string_view version = "0.20.3"sv;
79const std::string_view extension = "yue"sv; 79const std::string_view extension = "yue"sv;
80 80
81class CompileError : public std::logic_error { 81class CompileError : public std::logic_error {
@@ -6842,6 +6842,13 @@ private:
6842 varAfter.push_back(desVar); 6842 varAfter.push_back(desVar);
6843 break; 6843 break;
6844 } 6844 }
6845 case id<Comprehension_t>(): {
6846 auto desVar = getUnusedName("_des_"sv);
6847 destructPairs.emplace_back(item, toAst<Exp_t>(desVar, x));
6848 vars.push_back(desVar);
6849 varAfter.push_back(desVar);
6850 break;
6851 }
6845 default: YUEE("AST node mismatch", item); break; 6852 default: YUEE("AST node mismatch", item); break;
6846 } 6853 }
6847 } 6854 }
diff --git a/src/yuescript/yue_parser.cpp b/src/yuescript/yue_parser.cpp
index 8ceee9a..11c7627 100644
--- a/src/yuescript/yue_parser.cpp
+++ b/src/yuescript/yue_parser.cpp
@@ -835,7 +835,7 @@ YueParser::YueParser() {
835 MacroInPlace = '$' >> space >> "->" >> space >> Body; 835 MacroInPlace = '$' >> space >> "->" >> space >> Body;
836 836
837 NameList = Seperator >> Variable >> *(space >> ',' >> space >> Variable); 837 NameList = Seperator >> Variable >> *(space >> ',' >> space >> Variable);
838 NameOrDestructure = Variable | TableLit; 838 NameOrDestructure = Variable | TableLit | Comprehension;
839 AssignableNameList = Seperator >> NameOrDestructure >> *(space >> ',' >> space >> NameOrDestructure); 839 AssignableNameList = Seperator >> NameOrDestructure >> *(space >> ',' >> space >> NameOrDestructure);
840 840
841 FnArrowBack = '<' >> set("-="); 841 FnArrowBack = '<' >> set("-=");