diff options
author | Li Jin <dragon-fly@qq.com> | 2019-09-12 16:12:20 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2019-09-12 16:12:20 +0800 |
commit | 50353c1456324e7bd3c130fceaf400aed7880a41 (patch) | |
tree | 0afe5823040dc9fc9ab39a9d7f4af647c061d7c1 /MoonParser/moon_parser.cpp | |
parent | 4e6f4e8124316866a08f9ddf3322fde87abc3c21 (diff) | |
download | yuescript-50353c1456324e7bd3c130fceaf400aed7880a41.tar.gz yuescript-50353c1456324e7bd3c130fceaf400aed7880a41.tar.bz2 yuescript-50353c1456324e7bd3c130fceaf400aed7880a41.zip |
spec/assign.moon and spec/bubbling.moon compiled
Diffstat (limited to 'MoonParser/moon_parser.cpp')
-rw-r--r-- | MoonParser/moon_parser.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/MoonParser/moon_parser.cpp b/MoonParser/moon_parser.cpp index 7731513..ae8c53d 100644 --- a/MoonParser/moon_parser.cpp +++ b/MoonParser/moon_parser.cpp | |||
@@ -1,5 +1,13 @@ | |||
1 | #include "moon_parser.h" | 1 | #include "moon_parser.h" |
2 | 2 | ||
3 | std::unordered_set<std::string> State::keywords = { | ||
4 | "and", "while", "else", "using", "continue", | ||
5 | "local", "not", "then", "return", "from", | ||
6 | "extends", "for", "do", "or", "export", | ||
7 | "class", "in", "unless", "when", "elseif", | ||
8 | "switch", "break", "if", "with", "import", "true", "false", "nil" | ||
9 | }; | ||
10 | |||
3 | rule plain_space = *set(" \t"); | 11 | rule plain_space = *set(" \t"); |
4 | rule Break = nl(-expr('\r') >> '\n'); | 12 | rule Break = nl(-expr('\r') >> '\n'); |
5 | rule Any = Break | any(); | 13 | rule Any = Break | any(); |
@@ -185,7 +193,9 @@ rule For = key("for") >> DisableDo >> | |||
185 | 193 | ||
186 | extern rule AssignableNameList; | 194 | extern rule AssignableNameList; |
187 | 195 | ||
188 | rule for_in = sym('*') >> Exp | ExpList; | 196 | extern rule star_exp; |
197 | |||
198 | rule for_in = star_exp | ExpList; | ||
189 | 199 | ||
190 | rule ForEach = key("for") >> AssignableNameList >> key("in") >> | 200 | rule ForEach = key("for") >> AssignableNameList >> key("in") >> |
191 | DisableDo >> ensure(for_in, PopDo) >> | 201 | DisableDo >> ensure(for_in, PopDo) >> |