diff options
| author | Li Jin <dragon-fly@qq.com> | 2023-10-23 10:19:42 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2023-10-23 10:19:42 +0800 |
| commit | 08fef1c7698cff09689e9965d993931ca6081257 (patch) | |
| tree | 2d206d3b3b6cca927881a46873b53be3d0319221 /spec | |
| parent | 0ecd527e2b9e441c169bc66ecbac12d202b9d1f8 (diff) | |
| download | yuescript-0.20.1.tar.gz yuescript-0.20.1.tar.bz2 yuescript-0.20.1.zip | |
fix chaining condition evaluation rules.v0.20.1
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/inputs/cond.yue | 22 | ||||
| -rw-r--r-- | spec/outputs/cond.lua | 155 | ||||
| -rw-r--r-- | spec/outputs/unicode/cond.lua | 12 |
3 files changed, 185 insertions, 4 deletions
diff --git a/spec/inputs/cond.yue b/spec/inputs/cond.yue index df7d78e..f5f42a8 100644 --- a/spec/inputs/cond.yue +++ b/spec/inputs/cond.yue | |||
| @@ -237,6 +237,28 @@ do | |||
| 237 | 237 | ||
| 238 | evaluation = v(1) > v(2) <= v(3) | 238 | evaluation = v(1) > v(2) <= v(3) |
| 239 | 239 | ||
| 240 | do | ||
| 241 | a = v(1) < v(2) < v(3) < v(4) | ||
| 242 | a = x and y or v(1) < v(2) < v(3) < v(4) | ||
| 243 | a = v(1) < v(2) < v(3) < v(4) or x and y | ||
| 244 | a = x and y or v(1) < v(2) < v(3) < v(4) or w and z | ||
| 245 | |||
| 246 | a = v(1) < v(2) < v(3) and b < v(4) < v(5) < v(6) | ||
| 247 | a = x and y or v(1) < v(2) < v(3) and b < v(4) < v(5) < v(6) | ||
| 248 | a = v(1) < v(2) < v(3) and b < v(4) < v(5) < v(6) or x and y | ||
| 249 | a = x and y or v(1) < v(2) < v(3) and b < v(4) < v(5) < v(6) or w and z | ||
| 250 | |||
| 251 | local v1, v2, v3, v4, v5, v6 | ||
| 252 | a = v1 < v2 < v3 < v4 | ||
| 253 | a = x and y or v1 < v2 < v3 < v4 | ||
| 254 | a = v1 < v2 < v3 < v4 or x and y | ||
| 255 | a = x and y or v1 < v2 < v3 < v4 or w and z | ||
| 256 | |||
| 257 | a = v1 < v2 < v3 and b < v4 < v5 < v6 | ||
| 258 | a = x and y or v1 < v2 < v3 and b < v4 < v5 < v6 | ||
| 259 | a = v1 < v2 < v3 and b < v4 < v5 < v6 or x and y | ||
| 260 | a = x and y or v1 < v2 < v3 and b < v4 < v5 < v6 or w and z | ||
| 261 | |||
| 240 | nil | 262 | nil |
| 241 | 263 | ||
| 242 | 264 | ||
diff --git a/spec/outputs/cond.lua b/spec/outputs/cond.lua index 651c14a..d7aae02 100644 --- a/spec/outputs/cond.lua +++ b/spec/outputs/cond.lua | |||
| @@ -355,11 +355,162 @@ do | |||
| 355 | local evaluation | 355 | local evaluation |
| 356 | do | 356 | do |
| 357 | local _cond_0 = v(2) | 357 | local _cond_0 = v(2) |
| 358 | evaluation = v(1) < _cond_0 and _cond_0 <= v(3) | 358 | if not (v(1) < _cond_0) then |
| 359 | evaluation = false | ||
| 360 | else | ||
| 361 | evaluation = _cond_0 <= v(3) | ||
| 362 | end | ||
| 363 | end | ||
| 364 | do | ||
| 365 | local _cond_0 = v(2) | ||
| 366 | if not (v(1) > _cond_0) then | ||
| 367 | evaluation = false | ||
| 368 | else | ||
| 369 | evaluation = _cond_0 <= v(3) | ||
| 370 | end | ||
| 359 | end | 371 | end |
| 372 | end | ||
| 373 | do | ||
| 360 | do | 374 | do |
| 361 | local _cond_0 = v(2) | 375 | local _cond_0 = v(2) |
| 362 | evaluation = v(1) > _cond_0 and _cond_0 <= v(3) | 376 | if not (v(1) < _cond_0) then |
| 377 | a = false | ||
| 378 | else | ||
| 379 | local _cond_1 = v(3) | ||
| 380 | if not (_cond_0 < _cond_1) then | ||
| 381 | a = false | ||
| 382 | else | ||
| 383 | a = _cond_1 < v(4) | ||
| 384 | end | ||
| 385 | end | ||
| 363 | end | 386 | end |
| 387 | a = x and y or (function() | ||
| 388 | local _cond_0 = v(2) | ||
| 389 | if not (v(1) < _cond_0) then | ||
| 390 | return false | ||
| 391 | else | ||
| 392 | local _cond_1 = v(3) | ||
| 393 | if not (_cond_0 < _cond_1) then | ||
| 394 | return false | ||
| 395 | else | ||
| 396 | return _cond_1 < v(4) | ||
| 397 | end | ||
| 398 | end | ||
| 399 | end)() | ||
| 400 | a = (function() | ||
| 401 | local _cond_0 = v(2) | ||
| 402 | if not (v(1) < _cond_0) then | ||
| 403 | return false | ||
| 404 | else | ||
| 405 | local _cond_1 = v(3) | ||
| 406 | if not (_cond_0 < _cond_1) then | ||
| 407 | return false | ||
| 408 | else | ||
| 409 | return _cond_1 < v(4) | ||
| 410 | end | ||
| 411 | end | ||
| 412 | end)() or x and y | ||
| 413 | a = x and y or (function() | ||
| 414 | local _cond_0 = v(2) | ||
| 415 | if not (v(1) < _cond_0) then | ||
| 416 | return false | ||
| 417 | else | ||
| 418 | local _cond_1 = v(3) | ||
| 419 | if not (_cond_0 < _cond_1) then | ||
| 420 | return false | ||
| 421 | else | ||
| 422 | return _cond_1 < v(4) | ||
| 423 | end | ||
| 424 | end | ||
| 425 | end)() or w and z | ||
| 426 | a = (function() | ||
| 427 | local _cond_0 = v(2) | ||
| 428 | if not (v(1) < _cond_0) then | ||
| 429 | return false | ||
| 430 | else | ||
| 431 | return _cond_0 < v(3) | ||
| 432 | end | ||
| 433 | end)() and (function() | ||
| 434 | local _cond_0 = v(4) | ||
| 435 | if not (b < _cond_0) then | ||
| 436 | return false | ||
| 437 | else | ||
| 438 | local _cond_1 = v(5) | ||
| 439 | if not (_cond_0 < _cond_1) then | ||
| 440 | return false | ||
| 441 | else | ||
| 442 | return _cond_1 < v(6) | ||
| 443 | end | ||
| 444 | end | ||
| 445 | end)() | ||
| 446 | a = x and y or (function() | ||
| 447 | local _cond_0 = v(2) | ||
| 448 | if not (v(1) < _cond_0) then | ||
| 449 | return false | ||
| 450 | else | ||
| 451 | return _cond_0 < v(3) | ||
| 452 | end | ||
| 453 | end)() and (function() | ||
| 454 | local _cond_0 = v(4) | ||
| 455 | if not (b < _cond_0) then | ||
| 456 | return false | ||
| 457 | else | ||
| 458 | local _cond_1 = v(5) | ||
| 459 | if not (_cond_0 < _cond_1) then | ||
| 460 | return false | ||
| 461 | else | ||
| 462 | return _cond_1 < v(6) | ||
| 463 | end | ||
| 464 | end | ||
| 465 | end)() | ||
| 466 | a = (function() | ||
| 467 | local _cond_0 = v(2) | ||
| 468 | if not (v(1) < _cond_0) then | ||
| 469 | return false | ||
| 470 | else | ||
| 471 | return _cond_0 < v(3) | ||
| 472 | end | ||
| 473 | end)() and (function() | ||
| 474 | local _cond_0 = v(4) | ||
| 475 | if not (b < _cond_0) then | ||
| 476 | return false | ||
| 477 | else | ||
| 478 | local _cond_1 = v(5) | ||
| 479 | if not (_cond_0 < _cond_1) then | ||
| 480 | return false | ||
| 481 | else | ||
| 482 | return _cond_1 < v(6) | ||
| 483 | end | ||
| 484 | end | ||
| 485 | end)() or x and y | ||
| 486 | a = x and y or (function() | ||
| 487 | local _cond_0 = v(2) | ||
| 488 | if not (v(1) < _cond_0) then | ||
| 489 | return false | ||
| 490 | else | ||
| 491 | return _cond_0 < v(3) | ||
| 492 | end | ||
| 493 | end)() and (function() | ||
| 494 | local _cond_0 = v(4) | ||
| 495 | if not (b < _cond_0) then | ||
| 496 | return false | ||
| 497 | else | ||
| 498 | local _cond_1 = v(5) | ||
| 499 | if not (_cond_0 < _cond_1) then | ||
| 500 | return false | ||
| 501 | else | ||
| 502 | return _cond_1 < v(6) | ||
| 503 | end | ||
| 504 | end | ||
| 505 | end)() or w and z | ||
| 506 | local v1, v2, v3, v4, v5, v6 | ||
| 507 | a = v1 < v2 and v2 < v3 and v3 < v4 | ||
| 508 | a = x and y or v1 < v2 and v2 < v3 and v3 < v4 | ||
| 509 | a = v1 < v2 and v2 < v3 and v3 < v4 or x and y | ||
| 510 | a = x and y or v1 < v2 and v2 < v3 and v3 < v4 or w and z | ||
| 511 | a = v1 < v2 and v2 < v3 and b < v4 and v4 < v5 and v5 < v6 | ||
| 512 | a = x and y or v1 < v2 and v2 < v3 and b < v4 and v4 < v5 and v5 < v6 | ||
| 513 | a = v1 < v2 and v2 < v3 and b < v4 and v4 < v5 and v5 < v6 or x and y | ||
| 514 | a = x and y or v1 < v2 and v2 < v3 and b < v4 and v4 < v5 and v5 < v6 or w and z | ||
| 364 | end | 515 | end |
| 365 | return nil | 516 | return nil |
diff --git a/spec/outputs/unicode/cond.lua b/spec/outputs/unicode/cond.lua index 9a4ccb9..ed5d274 100644 --- a/spec/outputs/unicode/cond.lua +++ b/spec/outputs/unicode/cond.lua | |||
| @@ -361,11 +361,19 @@ do | |||
| 361 | local _u6c42_u503c | 361 | local _u6c42_u503c |
| 362 | do | 362 | do |
| 363 | local _cond_0 = _u503c(2) | 363 | local _cond_0 = _u503c(2) |
| 364 | _u6c42_u503c = _u503c(1) < _cond_0 and _cond_0 <= _u503c(3) | 364 | if not (_u503c(1) < _cond_0) then |
| 365 | _u6c42_u503c = false | ||
| 366 | else | ||
| 367 | _u6c42_u503c = _cond_0 <= _u503c(3) | ||
| 368 | end | ||
| 365 | end | 369 | end |
| 366 | do | 370 | do |
| 367 | local _cond_0 = _u503c(2) | 371 | local _cond_0 = _u503c(2) |
| 368 | _u6c42_u503c = _u503c(1) > _cond_0 and _cond_0 <= _u503c(3) | 372 | if not (_u503c(1) > _cond_0) then |
| 373 | _u6c42_u503c = false | ||
| 374 | else | ||
| 375 | _u6c42_u503c = _cond_0 <= _u503c(3) | ||
| 376 | end | ||
| 369 | end | 377 | end |
| 370 | end | 378 | end |
| 371 | return nil | 379 | return nil |
