diff options
Diffstat (limited to '')
| -rw-r--r-- | spec/inputs/syntax.moon | 24 | ||||
| -rw-r--r-- | spec/inputs/tables.moon | 13 | ||||
| -rw-r--r-- | src/MoonP/moon_parser.cpp | 4 |
3 files changed, 21 insertions, 20 deletions
diff --git a/spec/inputs/syntax.moon b/spec/inputs/syntax.moon index 4435a1e..99daac5 100644 --- a/spec/inputs/syntax.moon +++ b/spec/inputs/syntax.moon | |||
| @@ -284,8 +284,8 @@ z = a- b | |||
| 284 | str = --[[ | 284 | str = --[[ |
| 285 | This is a multi line comment. | 285 | This is a multi line comment. |
| 286 | It's OK. | 286 | It's OK. |
| 287 | ]] strA -- comment 1 | 287 | ]] strA \ -- comment 1 |
| 288 | .. strB -- comment 2 | 288 | .. strB \ -- comment 2 |
| 289 | .. strC | 289 | .. strC |
| 290 | 290 | ||
| 291 | func --[[port]] 3000, --[[ip]] "192.168.1.1" | 291 | func --[[port]] 3000, --[[ip]] "192.168.1.1" |
| @@ -322,7 +322,7 @@ v = { | |||
| 322 | a -1 | 322 | a -1 |
| 323 | a( | 323 | a( |
| 324 | -1) | 324 | -1) |
| 325 | a | 325 | a \ |
| 326 | - 1 | 326 | - 1 |
| 327 | a-1 | 327 | a-1 |
| 328 | a - 1 | 328 | a - 1 |
| @@ -335,7 +335,7 @@ v = { | |||
| 335 | a ~1 | 335 | a ~1 |
| 336 | a( | 336 | a( |
| 337 | ~1) | 337 | ~1) |
| 338 | a | 338 | a \ |
| 339 | ~ 1 | 339 | ~ 1 |
| 340 | a~1 | 340 | a~1 |
| 341 | a ~ 1 | 341 | a ~ 1 |
| @@ -347,26 +347,26 @@ v = { | |||
| 347 | } | 347 | } |
| 348 | 348 | ||
| 349 | do | 349 | do |
| 350 | a = 1 | 350 | a = 1 \ |
| 351 | + 2 | 351 | + 2 \ |
| 352 | * 3 / | 352 | * 3 / |
| 353 | 4 | 353 | 4 |
| 354 | 354 | ||
| 355 | _1 = f1 -1 | 355 | _1 = f1 -1 \ |
| 356 | + 2 | 356 | + 2 \ |
| 357 | + 3 | 357 | + 3 |
| 358 | 358 | ||
| 359 | _2 = f1 - 1 | 359 | _2 = f1 - 1 \ |
| 360 | + 2 | 360 | + 2 \ |
| 361 | + 3 | 361 | + 3 |
| 362 | 362 | ||
| 363 | f2 = (x)-> print x | 363 | f2 = (x)-> print x \ |
| 364 | +1 | 364 | +1 |
| 365 | 365 | ||
| 366 | a = f2! | 366 | a = f2! |
| 367 | -1 |> f2 | 367 | -1 |> f2 |
| 368 | 368 | ||
| 369 | a = f2! | 369 | a = f2! \ |
| 370 | - 1 |> f2 | 370 | - 1 |> f2 |
| 371 | 371 | ||
| 372 | _1 \ | 372 | _1 \ |
diff --git a/spec/inputs/tables.moon b/spec/inputs/tables.moon index a1e861b..079be35 100644 --- a/spec/inputs/tables.moon +++ b/spec/inputs/tables.moon | |||
| @@ -164,20 +164,21 @@ heroine = | |||
| 164 | age: 18 | 164 | age: 18 |
| 165 | job: "Princess" | 165 | job: "Princess" |
| 166 | likes: | 166 | likes: |
| 167 | # name: "kittens" | 167 | * name: "kittens" |
| 168 | img: "/image/kittens.png" | 168 | img: "/image/kittens.png" |
| 169 | # name: "flower" | 169 | * name: "flower" |
| 170 | img: "/image/flower.png" | 170 | img: "/image/flower.png" |
| 171 | items: | 171 | items: |
| 172 | # name: "ring" | 172 | * name: "ring" |
| 173 | amount: 2 | 173 | amount: 2 |
| 174 | # name: "necklace" | 174 | * name: "necklace" |
| 175 | amount: 1 | 175 | amount: 1 |
| 176 | status: | 176 | status: |
| 177 | desc: "weak" | 177 | desc: "weak" |
| 178 | # attribute: "health" | 178 | * attribute: "health" |
| 179 | value: 50 | 179 | value: 50 |
| 180 | # attribute: "mana" | 180 | * attribute: "mana" |
| 181 | value: 100 | 181 | value: 100 |
| 182 | 182 | ||
| 183 | nil | 183 | nil |
| 184 | |||
diff --git a/src/MoonP/moon_parser.cpp b/src/MoonP/moon_parser.cpp index 53a6b8f..394ce50 100644 --- a/src/MoonP/moon_parser.cpp +++ b/src/MoonP/moon_parser.cpp | |||
| @@ -332,7 +332,7 @@ MoonParser::MoonParser() { | |||
| 332 | expr(">>") | | 332 | expr(">>") | |
| 333 | expr("//") | | 333 | expr("//") | |
| 334 | set("+-*/%><|&~"); | 334 | set("+-*/%><|&~"); |
| 335 | exp_op_value = (White >> not_(unary_operator) | Space) >> BinaryOperator >> *SpaceBreak >> backcall_exp; | 335 | exp_op_value = Space >> BinaryOperator >> *SpaceBreak >> backcall_exp; |
| 336 | Exp = Seperator >> backcall_exp >> *exp_op_value; | 336 | Exp = Seperator >> backcall_exp >> *exp_op_value; |
| 337 | 337 | ||
| 338 | ChainValue = Seperator >> (Chain | Callable) >> -existential_op >> -InvokeArgs; | 338 | ChainValue = Seperator >> (Chain | Callable) >> -existential_op >> -InvokeArgs; |
| @@ -432,7 +432,7 @@ MoonParser::MoonParser() { | |||
| 432 | 432 | ||
| 433 | TableBlockInner = Seperator >> KeyValueLine >> *(+SpaceBreak >> KeyValueLine); | 433 | TableBlockInner = Seperator >> KeyValueLine >> *(+SpaceBreak >> KeyValueLine); |
| 434 | TableBlock = +SpaceBreak >> Advance >> ensure(TableBlockInner, PopIndent); | 434 | TableBlock = +SpaceBreak >> Advance >> ensure(TableBlockInner, PopIndent); |
| 435 | TableBlockIndent = sym('#') >> Seperator >> KeyValueList >> -sym(',') >> | 435 | TableBlockIndent = sym('*') >> Seperator >> KeyValueList >> -sym(',') >> |
| 436 | -(+SpaceBreak >> Advance >> ensure(KeyValueList >> -sym(',') >> *(+SpaceBreak >> KeyValueLine), PopIndent)); | 436 | -(+SpaceBreak >> Advance >> ensure(KeyValueList >> -sym(',') >> *(+SpaceBreak >> KeyValueLine), PopIndent)); |
| 437 | 437 | ||
| 438 | class_member_list = Seperator >> KeyValue >> *(sym(',') >> KeyValue); | 438 | class_member_list = Seperator >> KeyValue >> *(sym(',') >> KeyValue); |
