diff options
| author | Li Jin <dragon-fly@qq.com> | 2020-02-20 13:39:26 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2020-02-20 13:39:26 +0800 |
| commit | 3a084cfad7aa8da8d2c4b7849347b0832ef8e87e (patch) | |
| tree | 58704a96284a9011ce45b86ba59a8a227c2efc27 | |
| parent | 0eaea3f979ef46fe195649ee18400f014957db26 (diff) | |
| download | yuescript-3a084cfad7aa8da8d2c4b7849347b0832ef8e87e.tar.gz yuescript-3a084cfad7aa8da8d2c4b7849347b0832ef8e87e.tar.bz2 yuescript-3a084cfad7aa8da8d2c4b7849347b0832ef8e87e.zip | |
allow value list in assignment to be multiline fixing Moonscript issue 390.
Diffstat (limited to '')
| -rw-r--r-- | spec/inputs/class.moon | 16 | ||||
| -rw-r--r-- | spec/inputs/whitespace.moon | 14 | ||||
| -rw-r--r-- | src/MoonP/moon_parser.cpp | 2 |
3 files changed, 30 insertions, 2 deletions
diff --git a/spec/inputs/class.moon b/spec/inputs/class.moon index 83f3760..3288dc6 100644 --- a/spec/inputs/class.moon +++ b/spec/inputs/class.moon | |||
| @@ -210,4 +210,20 @@ class Wowha extends Thing | |||
| 210 | super\hello | 210 | super\hello |
| 211 | } | 211 | } |
| 212 | 212 | ||
| 213 | do | ||
| 214 | class Test | ||
| 215 | new: => @@if = true | ||
| 216 | @do: => 1 | ||
| 217 | test: => @@if and @@do! | ||
| 218 | test = Test! | ||
| 219 | test\test! | ||
| 220 | |||
| 221 | do | ||
| 222 | class Test | ||
| 223 | new: => @if = true | ||
| 224 | do: => 1 | ||
| 225 | test: => @if and @do! | ||
| 226 | test = Test! | ||
| 227 | test\test! | ||
| 228 | |||
| 213 | nil | 229 | nil |
diff --git a/spec/inputs/whitespace.moon b/spec/inputs/whitespace.moon index 36f14ae..0422443 100644 --- a/spec/inputs/whitespace.moon +++ b/spec/inputs/whitespace.moon | |||
| @@ -97,6 +97,18 @@ b( | |||
| 97 | c(one, two, | 97 | c(one, two, |
| 98 | three, four) | 98 | three, four) |
| 99 | 99 | ||
| 100 | -- | 100 | -- |
| 101 | |||
| 102 | f = -> | ||
| 103 | a, | ||
| 104 | b, | ||
| 105 | c | ||
| 106 | |||
| 107 | a, | ||
| 108 | b, | ||
| 109 | c = 1, | ||
| 110 | 2, | ||
| 111 | f | ||
| 112 | :abc | ||
| 101 | 113 | ||
| 102 | nil | 114 | nil |
diff --git a/src/MoonP/moon_parser.cpp b/src/MoonP/moon_parser.cpp index 1ba8ad3..0b59776 100644 --- a/src/MoonP/moon_parser.cpp +++ b/src/MoonP/moon_parser.cpp | |||
| @@ -241,7 +241,7 @@ MoonParser::MoonParser() { | |||
| 241 | CompFor = key("for") >> Space >> Variable >> sym('=') >> Exp >> sym(',') >> Exp >> -for_step_value; | 241 | CompFor = key("for") >> Space >> Variable >> sym('=') >> Exp >> sym(',') >> Exp >> -for_step_value; |
| 242 | CompClause = CompFor | CompForEach | key("when") >> Exp; | 242 | CompClause = CompFor | CompForEach | key("when") >> Exp; |
| 243 | 243 | ||
| 244 | Assign = sym('=') >> Seperator >> (With | If | Switch | TableBlock | Exp >> *((sym(',') | sym(';')) >> Exp)); | 244 | Assign = sym('=') >> Seperator >> (With | If | Switch | TableBlock | Exp >> *((sym(',') | sym(';')) >> White >> Exp)); |
| 245 | 245 | ||
| 246 | update_op = | 246 | update_op = |
| 247 | expr("..") | | 247 | expr("..") | |
