diff options
| author | Li Jin <dragon-fly@qq.com> | 2022-04-01 17:47:27 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2022-04-01 17:47:27 +0800 |
| commit | ca1ed557769352c0ac0ca7804dd25e18c1fdf2e1 (patch) | |
| tree | bf86d3990b90054f8d82aaf87cb9efae444a08ce /spec/inputs | |
| parent | 7be6c300256bfe411942a7ccc66f6bc3afa7390d (diff) | |
| download | yuescript-ca1ed557769352c0ac0ca7804dd25e18c1fdf2e1.tar.gz yuescript-ca1ed557769352c0ac0ca7804dd25e18c1fdf2e1.tar.bz2 yuescript-ca1ed557769352c0ac0ca7804dd25e18c1fdf2e1.zip | |
fix some ambiguous syntax caused by arg table block.
Diffstat (limited to 'spec/inputs')
| -rw-r--r-- | spec/inputs/ambiguous.yue | 30 | ||||
| -rw-r--r-- | spec/inputs/syntax.yue | 9 |
2 files changed, 35 insertions, 4 deletions
diff --git a/spec/inputs/ambiguous.yue b/spec/inputs/ambiguous.yue index 0e09979..3ae0bfc 100644 --- a/spec/inputs/ambiguous.yue +++ b/spec/inputs/ambiguous.yue | |||
| @@ -28,4 +28,34 @@ do | |||
| 28 | global * | 28 | global * |
| 29 | $v! | 29 | $v! |
| 30 | 30 | ||
| 31 | do | ||
| 32 | f | ||
| 33 | :v | ||
| 34 | |||
| 35 | tb = while f | ||
| 36 | :v | ||
| 37 | |||
| 38 | repeat | ||
| 39 | print v | ||
| 40 | until f | ||
| 41 | :v | ||
| 42 | |||
| 43 | with f | ||
| 44 | :v = tb | ||
| 45 | .x = 1 | ||
| 46 | |||
| 47 | x = if f | ||
| 48 | :v | ||
| 49 | |||
| 50 | x = switch f | ||
| 51 | :v | ||
| 52 | when f | ||
| 53 | :v | ||
| 54 | |||
| 55 | nums = for num = 1, len | ||
| 56 | :num | ||
| 57 | |||
| 58 | objects = for item in *items | ||
| 59 | name: item | ||
| 60 | |||
| 31 | nil | 61 | nil |
diff --git a/spec/inputs/syntax.yue b/spec/inputs/syntax.yue index e7f0a8d..84c6578 100644 --- a/spec/inputs/syntax.yue +++ b/spec/inputs/syntax.yue | |||
| @@ -267,11 +267,12 @@ z = x and b | |||
| 267 | z = x andb | 267 | z = x andb |
| 268 | 268 | ||
| 269 | 269 | ||
| 270 | -- undelimited tables | 270 | while 10 > something( |
| 271 | something: "world" | ||
| 272 | ) | ||
| 273 | print "yeah" | ||
| 271 | 274 | ||
| 272 | while 10 > something | 275 | -- undelimited tables |
| 273 | something: "world" | ||
| 274 | print "yeah" | ||
| 275 | 276 | ||
| 276 | x = | 277 | x = |
| 277 | okay: sure | 278 | okay: sure |
