mirror of
https://github.com/Reuh/anselme.git
synced 2025-10-27 08:39:30 +00:00
[language] Add multiple assignments, assignment and definitions are now function calls
This commit is contained in:
parent
760181eaf9
commit
b6473de4d2
36 changed files with 180 additions and 172 deletions
9
test/results/assignment tuple unpacking.ans
Normal file
9
test/results/assignment tuple unpacking.ans
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
--# run #--
|
||||
--- text ---
|
||||
| {}"" {}"3" {}"" |
|
||||
--- text ---
|
||||
| {}"" {}"4" {}"" |
|
||||
--- return ---
|
||||
()
|
||||
--# saved #--
|
||||
{}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
--# run #--
|
||||
--- error ---
|
||||
[0m[31m[0m[31mtrying to change the value of constant a[0m
|
||||
↳ from [4mtest/tests/constant variable.ans:5:3[0m in assignment: [2ma = 52[0m[0m
|
||||
↳ from [4mtest/tests/constant variable.ans:5:3[0m in call: [2ma = 52[0m[0m
|
||||
↳ from [4m?[0m in block: [2m::a = 3…[0m
|
||||
--# saved #--
|
||||
{}
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
| {}"" {}"type(12, \"kg\")" {}"" |
|
||||
--- error ---
|
||||
[0m[31m[0m[31mvalue check failure for weigh; 32 does not satisfy $(x) type(x) == t[0m
|
||||
↳ from [4mtest/tests/constrained variable assignement.ans:9:7[0m in assignment: [2mweigh = 32[0m[0m
|
||||
↳ from [4mtest/tests/constrained variable assignement.ans:9:7[0m in call: [2mweigh = 32[0m[0m
|
||||
↳ from [4m?[0m in block: [2m:weigh::is("kg") = type(5, "kg")…[0m
|
||||
--# saved #--
|
||||
{}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
--# run #--
|
||||
--- error ---
|
||||
[0m[31m[0m[31ma is already defined in the current scope[0m
|
||||
↳ from [4mtest/tests/define override function.ans:4:4[0m in definition: [2m:a = 2[0m[0m
|
||||
↳ from [4mtest/tests/define override function.ans:4:4[0m in call: [2m:a = 2[0m[0m
|
||||
↳ from [4m?[0m in block: [2m:a = ($() _)…[0m
|
||||
--# saved #--
|
||||
{}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
--# run #--
|
||||
--- error ---
|
||||
[0m[31m[0m[31mcan't add an overload variant to non-overloadable variable a defined in the same scope[0m
|
||||
↳ from [4mtest/tests/define override variable.ans:3:1[0m in definition: [2m:a = ($() _)[0m[0m
|
||||
↳ from [4mtest/tests/define override variable.ans:3:1[0m in call: [2m:a = ($() _)[0m[0m
|
||||
↳ from [4m?[0m in block: [2m:a = 2…[0m
|
||||
--# saved #--
|
||||
{}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
--# run #--
|
||||
--- error ---
|
||||
[0m[31m[0m[31ma is already defined in the current scope[0m
|
||||
↳ from [4mtest/tests/define override.ans:3:4[0m in definition: [2m:a = 2[0m[0m
|
||||
↳ from [4mtest/tests/define override.ans:3:4[0m in call: [2m:a = 2[0m[0m
|
||||
↳ from [4m?[0m in block: [2m:a = 5…[0m
|
||||
--# saved #--
|
||||
{}
|
||||
9
test/results/defininion tuple unpacking.ans
Normal file
9
test/results/defininion tuple unpacking.ans
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
--# run #--
|
||||
--- text ---
|
||||
| {}"" {}"3" {}"" |
|
||||
--- text ---
|
||||
| {}"" {}"4" {}"" |
|
||||
--- return ---
|
||||
()
|
||||
--# saved #--
|
||||
{}
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
• $(s::is struct) (from stdlib/for.ans:2:1):
|
||||
value check failure for parameter s[0m
|
||||
↳ from [4mstdlib/for.ans:3:18[0m in call: [2miter(var)[0m[0m
|
||||
↳ from [4mstdlib/for.ans:3:12[0m in definition: [2m:iterator = iter(var)[0m[0m
|
||||
↳ from [4mstdlib/for.ans:3:12[0m in call: [2m:iterator = iter(var)[0m[0m
|
||||
↳ from [4mstdlib/for.ans:2:1[0m in block: [2m:iterator = iter(var)…[0m[0m
|
||||
↳ from [4mstdlib/for.ans:2:71[0m in call: [2m_[0m[0m
|
||||
↳ from [4mtest/tests/for invalid iterator.ans:1:4[0m in call: [2mfor(:x, 42)[0m[0m
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
--# run #--
|
||||
--- error ---
|
||||
[0m[31m[0m[31ma function with parameters $(a, b) is already defined in the overload[0m
|
||||
↳ from [4mtest/tests/function conflict.ans:5:1[0m in definition: [2m:f = ($(a, b) 0)[0m[0m
|
||||
↳ from [4mtest/tests/function conflict.ans:5:1[0m in call: [2m:f = ($(a, b) 0)[0m[0m
|
||||
↳ from [4m?[0m in block: [2m:f = ($(a, b) 0)…[0m
|
||||
--# saved #--
|
||||
{}
|
||||
9
test/results/swap assignment.ans
Normal file
9
test/results/swap assignment.ans
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
--# run #--
|
||||
--- text ---
|
||||
| {}"" {}"2" {}"" |
|
||||
--- text ---
|
||||
| {}"" {}"1" {}"" |
|
||||
--- return ---
|
||||
()
|
||||
--# saved #--
|
||||
{}
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
| {}"d=" {}"2" {}" (2)" |
|
||||
--- error ---
|
||||
[0m[31m[0m[31mtrying to change the value of constant d[0m
|
||||
↳ from [4mtest/tests/symbol alias constant.ans:12:3[0m in assignment: [2md = 5[0m[0m
|
||||
↳ from [4mtest/tests/symbol alias constant.ans:12:3[0m in call: [2md = 5[0m[0m
|
||||
↳ from [4m?[0m in block: [2m:l = *[1, 2, 3]…[0m
|
||||
--# saved #--
|
||||
{}
|
||||
7
test/tests/assignment tuple unpacking.ans
Normal file
7
test/tests/assignment tuple unpacking.ans
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
:a = 0
|
||||
:b = 1
|
||||
(a, b) = (3, 4)
|
||||
|
||||
|{a}
|
||||
|
||||
|{b}
|
||||
5
test/tests/defininion tuple unpacking.ans
Normal file
5
test/tests/defininion tuple unpacking.ans
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
(:a, :b) = (3, 4)
|
||||
|
||||
|{a}
|
||||
|
||||
|{b}
|
||||
8
test/tests/swap assignment.ans
Normal file
8
test/tests/swap assignment.ans
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
:a = 1
|
||||
:b = 2
|
||||
|
||||
(a, b) = (b, a)
|
||||
|
||||
|{a}
|
||||
|
||||
|{b}
|
||||
Loading…
Add table
Add a link
Reference in a new issue