1
0
Fork 0
mirror of https://github.com/Reuh/anselme.git synced 2025-10-27 16:49:31 +00:00

Update tests

This commit is contained in:
Étienne Fildadut 2024-01-02 00:36:10 +01:00
parent a79b054bfb
commit a85e7ab0af
73 changed files with 246 additions and 157 deletions

View file

@ -0,0 +1,38 @@
local class = require("anselme.lib.class")
local ast = require("anselme.ast")
local Identifier
-- stack of resumable contexts
local calling_env_identifier, calling_env_symbol
local calling_environment_manager = class {
init = false,
push = function(self, state, calling_environment)
state.scope:push_partial(calling_env_identifier)
state.scope:define(calling_env_symbol, calling_environment)
end,
pop = function(self, state)
state.scope:pop()
end,
get_level = function(self, state, level)
local env = state.scope:capture()
while level > 0 do
assert(env:defined(state, calling_env_identifier), "no calling function")
env = env:get(state, calling_env_identifier)
level = level - 1
end
return env
end,
}
package.loaded[...] = calling_environment_manager
Identifier = ast.Identifier
calling_env_identifier = Identifier:new("_calling_environment")
calling_env_symbol = calling_env_identifier:to_symbol()
return calling_environment_manager

View file

@ -4,7 +4,7 @@
--- text --- --- text ---
| {}"" {}"type(\"kg\", 12)" {}"" | | {}"" {}"type(\"kg\", 12)" {}"" |
--- error --- --- error ---
type check failure for weigh; 32 does not satisfy ($(x) type(x) == t) type check failure for weigh; 32 does not satisfy $(x) type(x) == t
↳ from test/tests/constrained variable assignement.ans:9:7 in assignment: weigh = 32 ↳ from test/tests/constrained variable assignement.ans:9:7 in assignment: weigh = 32
↳ from ? in block: :weigh::is("kg") = type(5, "kg")… ↳ from ? in block: :weigh::is("kg") = type(5, "kg")…
--# saved #-- --# saved #--

View file

@ -0,0 +1,7 @@
--# run #--
--- text ---
| {}"ok" |
--- return ---
()
--# saved #--
{"fn.checkpoint":false, "fn.run":1}

View file

@ -5,7 +5,7 @@
--- text --- --- text ---
| {}"" {}"42" {}"" | | {}"" {}"42" {}"" |
--- error --- --- error ---
identifier "z" is undefined in branch 1228bcf1-5118-4955-10048-8fda790007be identifier "z" is undefined in branch cf017f8a-7c86-4871-109af-6658231331e6
↳ from test/tests/exported variable nested.ans:12:3 in identifier: z ↳ from test/tests/exported variable nested.ans:12:3 in identifier: z
↳ from test/tests/exported variable nested.ans:12:1 in text interpolation: | {z} | ↳ from test/tests/exported variable nested.ans:12:1 in text interpolation: | {z} |
↳ from test/tests/exported variable nested.ans:12:1 in translatable: | {z} | ↳ from test/tests/exported variable nested.ans:12:1 in translatable: | {z} |

View file

@ -1,6 +1,6 @@
--# run #-- --# run #--
--- error --- --- error ---
can't call closure ($(a, b) _): expected 2 arguments, received 1 can't call function $(a, b) _: expected 2 arguments, received 1
↳ from test/tests/function args arity check fail.ans:4:2 in call: f("ok") ↳ from test/tests/function args arity check fail.ans:4:2 in call: f("ok")
↳ from ? in block: :f = ($(a, b) _)… ↳ from ? in block: :f = ($(a, b) _)…
--# saved #-- --# saved #--

View file

@ -2,14 +2,14 @@
--- text --- --- text ---
| {}"c" | | {}"c" |
--- text --- --- text ---
| {}"a" | | {}"b" |
--- text ---
| {}"c" |
--- text --- --- text ---
| {}"a" | | {}"a" |
--- text --- --- text ---
| {}"b" | | {}"b" |
--- text ---
| {}"b" |
--- return --- --- return ---
() ()
--# saved #-- --# saved #--
{"a.checkpoint":false, "a.run":2, "b.checkpoint":false, "b.run":1, "c.checkpoint":false, "c.run":2} {"a.checkpoint":false, "a.run":1, "b.checkpoint":false, "b.run":3, "c.checkpoint":false, "c.run":1}

View file

@ -1,6 +1,6 @@
--# run #-- --# run #--
--- error --- --- error ---
identifier "b" is undefined in branch 57b4c67d-b128-4b9a-11e39-0e6612f1210e identifier "b" is undefined in branch cf017f8a-7c86-4871-109af-6658231331e6
↳ from test/tests/function scope wrong.ans:4:7 in identifier: b ↳ from test/tests/function scope wrong.ans:4:7 in identifier: b
↳ from test/tests/function scope wrong.ans:4:1 in text interpolation: | a: {b} | ↳ from test/tests/function scope wrong.ans:4:1 in text interpolation: | a: {b} |
↳ from test/tests/function scope wrong.ans:4:1 in translatable: | a: {b} | ↳ from test/tests/function scope wrong.ans:4:1 in translatable: | a: {b} |

View file

@ -34,8 +34,8 @@
| {}"" {}"\"d\":[]" {}"" | | {}"" {}"\"d\":[]" {}"" |
--- text --- --- text ---
| {}"function:" | | {}"function:" |
| {}"" {}"($() 12)" {}"" | | {}"" {}"$() 12" {}"" |
| {}"" {}"($(x) x)" {}"" | | {}"" {}"$(x) x" {}"" |
--- return --- --- return ---
() ()
--# saved #-- --# saved #--

View file

@ -1,25 +1,21 @@
--# run #-- --# run #--
--- error --- --- error ---
abort abort
↳ from test/tests/merge nested mutable error bis.ans:14:7 in call: error("abort") ↳ from test/tests/merge nested mutable error bis.ans:14:7 in call: error("abort")
↳ from test/tests/merge nested mutable error bis.ans:3:1 in block: insert(a, b)… ↳ from test/tests/merge nested mutable error bis.ans:3:1 in block: insert(a, b)…
↳ from test/tests/merge nested mutable error bis.ans:3:18 in call: _ ↳ from test/tests/merge nested mutable error bis.ans:3:18 in call: _
↳ from test/tests/merge nested mutable error bis.ans:3:17 in return boundary: _ ↳ from test/tests/merge nested mutable error bis.ans:3:17 in return boundary: _
↳ from test/tests/merge nested mutable error bis.ans:3:17 in return boundary: _
↳ from script.ans:29:6 in call: fn! ↳ from script.ans:29:6 in call: fn!
↳ from script.ans:27:3 in block: resumed from = ()… ↳ from script.ans:27:3 in block: resumed from = ()…
↳ from script.ans:27:5 in call: _ ↳ from script.ans:27:7 in call: else!
↳ from script.ans:27:3 in call: ~_ ↳ from script.ans:27:3 in partial scope: else!…
↳ from script.ans:27:3 in partial scope: ~_… ↳ from script.ans:23:2 in block: if(fn . "current checkpoint")…
↳ from script.ans:23:2 in block: fn . "current checkpoint" ~…
↳ from script.ans:23:9 in call: _ ↳ from script.ans:23:9 in call: _
↳ from script.ans:23:7 in return boundary: _ ↳ from script.ans:23:7 in return boundary: _
↳ from script.ans:23:7 in return boundary: _
↳ from script.ans:37:9 in call: value(s)! ↳ from script.ans:37:9 in call: value(s)!
↳ from script.ans:36:1 in block: value(s)! ↳ from script.ans:36:1 in block: value(s)!
↳ from script.ans:36:20 in call: _ ↳ from script.ans:36:20 in call: _
↳ from script.ans:36:1 in return boundary: _ ↳ from script.ans:36:1 in return boundary: _
↳ from script.ans:36:1 in return boundary: _
↳ from test/tests/merge nested mutable error bis.ans:19:2 in call: f! ↳ from test/tests/merge nested mutable error bis.ans:19:2 in call: f!
↳ from ? in block: :a = *[1]… ↳ from ? in block: :a = *[1]…
--# post run check #-- --# post run check #--

View file

@ -1,25 +1,21 @@
--# run #-- --# run #--
--- error --- --- error ---
abort abort
↳ from test/tests/merge nested mutable error.ans:14:7 in call: error("abort") ↳ from test/tests/merge nested mutable error.ans:14:7 in call: error("abort")
↳ from test/tests/merge nested mutable error.ans:3:1 in block: insert(a, b)… ↳ from test/tests/merge nested mutable error.ans:3:1 in block: insert(a, b)…
↳ from test/tests/merge nested mutable error.ans:3:18 in call: _ ↳ from test/tests/merge nested mutable error.ans:3:18 in call: _
↳ from test/tests/merge nested mutable error.ans:3:17 in return boundary: _ ↳ from test/tests/merge nested mutable error.ans:3:17 in return boundary: _
↳ from test/tests/merge nested mutable error.ans:3:17 in return boundary: _
↳ from script.ans:29:6 in call: fn! ↳ from script.ans:29:6 in call: fn!
↳ from script.ans:27:3 in block: resumed from = ()… ↳ from script.ans:27:3 in block: resumed from = ()…
↳ from script.ans:27:5 in call: _ ↳ from script.ans:27:7 in call: else!
↳ from script.ans:27:3 in call: ~_ ↳ from script.ans:27:3 in partial scope: else!…
↳ from script.ans:27:3 in partial scope: ~_… ↳ from script.ans:23:2 in block: if(fn . "current checkpoint")…
↳ from script.ans:23:2 in block: fn . "current checkpoint" ~…
↳ from script.ans:23:9 in call: _ ↳ from script.ans:23:9 in call: _
↳ from script.ans:23:7 in return boundary: _ ↳ from script.ans:23:7 in return boundary: _
↳ from script.ans:23:7 in return boundary: _
↳ from script.ans:37:9 in call: value(s)! ↳ from script.ans:37:9 in call: value(s)!
↳ from script.ans:36:1 in block: value(s)! ↳ from script.ans:36:1 in block: value(s)!
↳ from script.ans:36:20 in call: _ ↳ from script.ans:36:20 in call: _
↳ from script.ans:36:1 in return boundary: _ ↳ from script.ans:36:1 in return boundary: _
↳ from script.ans:36:1 in return boundary: _
↳ from test/tests/merge nested mutable error.ans:19:2 in call: f! ↳ from test/tests/merge nested mutable error.ans:19:2 in call: f!
↳ from ? in block: :a = *[1]… ↳ from ? in block: :a = *[1]…
--# post run check #-- --# post run check #--

View file

@ -14,21 +14,18 @@
--- text --- --- text ---
| {}"CHECK 2" | | {}"CHECK 2" |
--- error --- --- error ---
t t
↳ from test/tests/scope checkpoint mutable bis error.ans:32:7 in call: error("t") ↳ from test/tests/scope checkpoint mutable bis error.ans:32:7 in call: error("t")
↳ from test/tests/scope checkpoint mutable bis error.ans:7:1 in block: insert(t, len(l) + 1)… ↳ from test/tests/scope checkpoint mutable bis error.ans:7:1 in block: insert(t, len(l) + 1)…
↳ from test/tests/scope checkpoint mutable bis error.ans:7:8 in call: _ ↳ from test/tests/scope checkpoint mutable bis error.ans:7:8 in call: _
↳ from test/tests/scope checkpoint mutable bis error.ans:7:1 in return boundary: _ ↳ from test/tests/scope checkpoint mutable bis error.ans:7:1 in return boundary: _
↳ from test/tests/scope checkpoint mutable bis error.ans:7:1 in return boundary: _
↳ from test/tests/scope checkpoint mutable bis error.ans:19:4 in call: f(t) ↳ from test/tests/scope checkpoint mutable bis error.ans:19:4 in call: f(t)
↳ from test/tests/scope checkpoint mutable bis error.ans:15:2 in block: | REC |… ↳ from test/tests/scope checkpoint mutable bis error.ans:15:2 in block: | REC |…
↳ from test/tests/scope checkpoint mutable bis error.ans:15:10 in call: _ ↳ from test/tests/scope checkpoint mutable bis error.ans:15:4 in call: if(n < 1)
↳ from test/tests/scope checkpoint mutable bis error.ans:15:8 in call: n < 1 ~ _ ↳ from test/tests/scope checkpoint mutable bis error.ans:15:2 in partial scope: if(n < 1)…
↳ from test/tests/scope checkpoint mutable bis error.ans:15:2 in partial scope: n < 1 ~…
↳ from test/tests/scope checkpoint mutable bis error.ans:7:1 in block: insert(t, len(l) + 1)… ↳ from test/tests/scope checkpoint mutable bis error.ans:7:1 in block: insert(t, len(l) + 1)…
↳ from test/tests/scope checkpoint mutable bis error.ans:7:8 in call: _ ↳ from test/tests/scope checkpoint mutable bis error.ans:7:8 in call: _
↳ from test/tests/scope checkpoint mutable bis error.ans:7:1 in return boundary: _ ↳ from test/tests/scope checkpoint mutable bis error.ans:7:1 in return boundary: _
↳ from test/tests/scope checkpoint mutable bis error.ans:7:1 in return boundary: _
↳ from test/tests/scope checkpoint mutable bis error.ans:41:2 in call: f(l) ↳ from test/tests/scope checkpoint mutable bis error.ans:41:2 in call: f(l)
↳ from ? in block: :x = *[99]… ↳ from ? in block: :x = *[99]…
--# post run check #-- --# post run check #--

View file

@ -10,21 +10,18 @@
--- text --- --- text ---
| {}"CHECK" | | {}"CHECK" |
--- error --- --- error ---
t t
↳ from test/tests/scope checkpoint mutable error.ans:23:7 in call: error("t") ↳ from test/tests/scope checkpoint mutable error.ans:23:7 in call: error("t")
↳ from test/tests/scope checkpoint mutable error.ans:5:1 in block: insert(t, len(l) + 1)… ↳ from test/tests/scope checkpoint mutable error.ans:5:1 in block: insert(t, len(l) + 1)…
↳ from test/tests/scope checkpoint mutable error.ans:5:8 in call: _ ↳ from test/tests/scope checkpoint mutable error.ans:5:8 in call: _
↳ from test/tests/scope checkpoint mutable error.ans:5:1 in return boundary: _ ↳ from test/tests/scope checkpoint mutable error.ans:5:1 in return boundary: _
↳ from test/tests/scope checkpoint mutable error.ans:5:1 in return boundary: _
↳ from test/tests/scope checkpoint mutable error.ans:17:4 in call: f(t) ↳ from test/tests/scope checkpoint mutable error.ans:17:4 in call: f(t)
↳ from test/tests/scope checkpoint mutable error.ans:13:2 in block: | REC |… ↳ from test/tests/scope checkpoint mutable error.ans:13:2 in block: | REC |…
↳ from test/tests/scope checkpoint mutable error.ans:13:10 in call: _ ↳ from test/tests/scope checkpoint mutable error.ans:13:4 in call: if(n < 1)
↳ from test/tests/scope checkpoint mutable error.ans:13:8 in call: n < 1 ~ _ ↳ from test/tests/scope checkpoint mutable error.ans:13:2 in partial scope: if(n < 1)…
↳ from test/tests/scope checkpoint mutable error.ans:13:2 in partial scope: n < 1 ~…
↳ from test/tests/scope checkpoint mutable error.ans:5:1 in block: insert(t, len(l) + 1)… ↳ from test/tests/scope checkpoint mutable error.ans:5:1 in block: insert(t, len(l) + 1)…
↳ from test/tests/scope checkpoint mutable error.ans:5:8 in call: _ ↳ from test/tests/scope checkpoint mutable error.ans:5:8 in call: _
↳ from test/tests/scope checkpoint mutable error.ans:5:1 in return boundary: _ ↳ from test/tests/scope checkpoint mutable error.ans:5:1 in return boundary: _
↳ from test/tests/scope checkpoint mutable error.ans:5:1 in return boundary: _
↳ from test/tests/scope checkpoint mutable error.ans:32:2 in call: f(l) ↳ from test/tests/scope checkpoint mutable error.ans:32:2 in call: f(l)
↳ from ? in block: :l = *[1]… ↳ from ? in block: :l = *[1]…
--# post run check #-- --# post run check #--

View file

@ -14,21 +14,18 @@
--- text --- --- text ---
| {}"CHECK 2" | | {}"CHECK 2" |
--- error --- --- error ---
t t
↳ from test/tests/scope checkpoint mutable ter error.ans:34:7 in call: error("t") ↳ from test/tests/scope checkpoint mutable ter error.ans:34:7 in call: error("t")
↳ from test/tests/scope checkpoint mutable ter error.ans:7:1 in block: insert(t, len(l) + 1)… ↳ from test/tests/scope checkpoint mutable ter error.ans:7:1 in block: insert(t, len(l) + 1)…
↳ from test/tests/scope checkpoint mutable ter error.ans:7:8 in call: _ ↳ from test/tests/scope checkpoint mutable ter error.ans:7:8 in call: _
↳ from test/tests/scope checkpoint mutable ter error.ans:7:1 in return boundary: _ ↳ from test/tests/scope checkpoint mutable ter error.ans:7:1 in return boundary: _
↳ from test/tests/scope checkpoint mutable ter error.ans:7:1 in return boundary: _
↳ from test/tests/scope checkpoint mutable ter error.ans:19:4 in call: f(t) ↳ from test/tests/scope checkpoint mutable ter error.ans:19:4 in call: f(t)
↳ from test/tests/scope checkpoint mutable ter error.ans:15:2 in block: | REC |… ↳ from test/tests/scope checkpoint mutable ter error.ans:15:2 in block: | REC |…
↳ from test/tests/scope checkpoint mutable ter error.ans:15:10 in call: _ ↳ from test/tests/scope checkpoint mutable ter error.ans:15:4 in call: if(n < 1)
↳ from test/tests/scope checkpoint mutable ter error.ans:15:8 in call: n < 1 ~ _ ↳ from test/tests/scope checkpoint mutable ter error.ans:15:2 in partial scope: if(n < 1)…
↳ from test/tests/scope checkpoint mutable ter error.ans:15:2 in partial scope: n < 1 ~…
↳ from test/tests/scope checkpoint mutable ter error.ans:7:1 in block: insert(t, len(l) + 1)… ↳ from test/tests/scope checkpoint mutable ter error.ans:7:1 in block: insert(t, len(l) + 1)…
↳ from test/tests/scope checkpoint mutable ter error.ans:7:8 in call: _ ↳ from test/tests/scope checkpoint mutable ter error.ans:7:8 in call: _
↳ from test/tests/scope checkpoint mutable ter error.ans:7:1 in return boundary: _ ↳ from test/tests/scope checkpoint mutable ter error.ans:7:1 in return boundary: _
↳ from test/tests/scope checkpoint mutable ter error.ans:7:1 in return boundary: _
↳ from test/tests/scope checkpoint mutable ter error.ans:43:2 in call: f(l) ↳ from test/tests/scope checkpoint mutable ter error.ans:43:2 in call: f(l)
↳ from ? in block: :x = *[99]… ↳ from ? in block: :x = *[99]…
--# post run check #-- --# post run check #--

View file

@ -2,6 +2,6 @@
--- text --- --- text ---
| {1:1}"lol" | | {1:1}"lol" |
--- return --- --- return ---
@| {}"a " {1:2}"d" {}" " {1:3}"t" {}" b" | | {}"a " {1:2}"d" {}" " {1:3}"t" {}" b" |
--# saved #-- --# saved #--
{} {}

View file

@ -2,6 +2,6 @@
--- text --- --- text ---
| {}"lol" | | {}"lol" |
--- return --- --- return ---
@| {}"a " {}"d" {}" b" | | {}"a " {}"d" {}" b" |
--# saved #-- --# saved #--
{} {}

View file

@ -0,0 +1,19 @@
--# run #--
--- text ---
| {}"" {}"0" {}"" |
--- text ---
| {}"" {}"1" {}"" |
--- text ---
| {}"" {}"2" {}"" |
--- text ---
| {}"" {}"3" {}"" |
--- text ---
| {}"" {}"4" {}"" |
--- text ---
| {}"" {}"5" {}"" |
--- text ---
| {}"ok" |
--- return ---
()
--# saved #--
{}

View file

@ -0,0 +1,17 @@
--# run #--
--- text ---
| {}"" {}"1" {}"" |
--- text ---
| {}"" {}"2" {}"" |
--- text ---
| {}"" {}"4" {}"" |
--- text ---
| {}"" {}"5" {}"" |
--- text ---
| {}"" {}"6" {}"" |
--- text ---
| {}"ok" |
--- return ---
()
--# saved #--
{}

View file

@ -36,6 +36,6 @@
--- text --- --- text ---
| {}"" {}"5" {}"" | | {}"" {}"5" {}"" |
--- return --- --- return ---
@() ()
--# saved #-- --# saved #--
{} {}

View file

@ -1,8 +1,8 @@
:$ a - b :$ a - b
@"generic minus" return("generic minus")
:$ a::string - b::string :$ a::string - b::string
@a + " minus " + b return(a + " minus " + b)
| {2-5} | {2-5}

View file

@ -3,7 +3,7 @@
:$ jump button :$ jump button
1 # |A 1 # |A
| Suprise choice! |> () | Suprise choice! |> ()
@"JOIN" return("JOIN")
| Press {jump button!} to jump. |> | Press {jump button!} to jump. |>
|ok |ok

View file

@ -3,7 +3,7 @@
:$ jump button :$ jump button
1 # | a 1 # | a
@"SPLIT" return("SPLIT")
| Press {jump button!} to jump. |> | Press {jump button!} to jump. |>
| ok | ok

View file

@ -1,9 +1,9 @@
:$ jump button :$ jump button
@1 # | A return(1 # | A)
:$ move axis :$ move axis
1 # | left 1 # | left
@" joystick" return(" joystick")
| Press {jump button!} to jump. |> | Press {jump button!} to jump. |>
|ok |ok

View file

@ -1,16 +1,17 @@
1 ~ | a |> if(1)
| -> a | a |>
| -> a
| b |> | b |>
| -> b | -> b
:@choice = 1 :@choice = 1
1 ~ | a |> if(1, $| a |> _)
| -> a | -> a
| b |> | b |>
| -> b | -> b
choice = 2 choice = 2
() ~ | a |> if((), $| a |> _)
| -> a | -> a
| b |> | b |>
| -> b | -> b
@ -22,13 +23,13 @@ choice = 1
| -> b | -> b
choice = 2 choice = 2
12 # () ~ | a |> 12 # if((), $| a |> _)
| -> a | -> a
3 # | b |> 3 # | b |>
| -> b | -> b
choice = 1 choice = 1
12 # 1 ~ | a |> 12 # if(1, $| a |> _)
| -> a | -> a
3 # | b |> 3 # | b |>
| -> b | -> b

View file

@ -1,3 +1,3 @@
() ~ |ko if((), $|ko)
1 ~ |ok if(1, $|ok)
1 ~ |ok bis if(1, $|ok bis)

View file

@ -1,6 +1,6 @@
:a = 5 :a = 5
a == 2 ~ if(a == 2)
|ko |ko
~ else!
|ok |ok

View file

@ -1,6 +1,6 @@
:a = 5 :a = 5
a == 5 ~ if(a == 5)
|ok |ok
~ else!
|ko |ko

View file

@ -1,8 +1,8 @@
:a = 5 :a = 5
a == 2 ~ if(a == 2)
|ko |ko
~ () ~ else if(())
|ko |ko
~ else!
|ok |ok

View file

@ -1,8 +1,8 @@
:a = 5 :a = 5
a == 2 ~ if(a == 2)
|ko |ko
~ 1 ~ else if(1)
|ok |ok
~ else!
|ko |ko

View file

@ -1,4 +1,4 @@
:a = 5 :a = 5
a == 2 ~ if(a == 2)
|ko |ko

View file

@ -1,6 +1,6 @@
:$ f :$ f
@|b return(|b)
|a {5 ~ f!} c |a {if(5, f)} c
|a {() ~ f!} c |a {if((), f)} c

View file

@ -1,4 +1,4 @@
:a = 5 :a = 5
a == 5 ~ if(a == 5)
|ok |ok

View file

@ -2,10 +2,10 @@
:$ format(p::is(person)) :$ format(p::is(person))
p = p!value p = p!value
@"Name: {p("name")}\nAge: {p("age")}" return("Name: {p("name")}\nAge: {p("age")}")
:$ Person(name, age) :$ Person(name, age)
@{"name":name, "age":age}!type(person) return({"name":name, "age":age}!type(person))
:abject = Person("Darmanin", 38) :abject = Person("Darmanin", 38)

View file

@ -0,0 +1,4 @@
:fn = "fn"!script
|ok
fn!

View file

@ -1,7 +1,7 @@
:a = 5 :a = 5
:$ f(p) :$ f(p)
@a return(a)
:$ f(p) = v :$ f(p) = v
|v={v} |v={v}

View file

@ -1,7 +1,7 @@
:f = $(x)x*x :f = $(x)x*x
:$g(x) :$g(x)
@x*x return(x*x)
|{f(5)} = {g(5)} |{f(5)} = {g(5)}

View file

@ -1,8 +1,8 @@
:$ hey :$ hey
:@$ foo :@$ foo
@2 return(2)
@3 return(3)
@5 return(5)
|u |u
|{hey!} |{hey!}

View file

@ -1,6 +1,6 @@
:$ hey :$ hey
@5 return(5)
|a |a
@2 return(2)
|{hey!} |{hey!}

View file

@ -1,7 +1,7 @@
:$ hey :$ hey
:@$ foo :@$ foo
@2 return(2)
@5 return(5)
|{hey!} |{hey!}
|{hey.foo!} |{hey.foo!}

View file

@ -1,4 +1,4 @@
:$ hey :$ hey
@5 return(5)
|{hey!} |{hey!}

View file

@ -11,7 +11,7 @@
|before recursion {c}: {a} |before recursion {c}: {a}
n < 5 ~ if(n < 5)
f(c+1) f(c+1)
|after recursion {c}: {a} |after recursion {c}: {a}
@ -29,7 +29,7 @@ f!
|before recursion {c}: {a} |before recursion {c}: {a}
n < 5 ~ if(n < 5)
g(c+1, a) g(c+1, a)
|after recursion {c}: {a} |after recursion {c}: {a}

View file

@ -11,7 +11,7 @@
|before recursion {c}: {a} |before recursion {c}: {a}
n < 5 ~ if(n < 5)
f(c+1) f(c+1)
|after recursion {c}: {a} |after recursion {c}: {a}

View file

@ -1,9 +1,9 @@
:$ a(x::number) :$ a(x::number)
@x + 2 return(x + 2)
:$ x :$ x
:$ a(x::string) :$ a(x::string)
@x + "heh" return(x + "heh")
|{a("plop")} |{a("plop")}

View file

@ -11,10 +11,10 @@ fn(5)
fn() fn()
:$ g(n="s", a::number=5) :$ g(n="s", a::number=5)
@"gn" return("gn")
:$ g(n="s", a::string="lol") :$ g(n="s", a::string="lol")
@"gs" return("gs")
|{g(n="k", a="l")} |{g(n="k", a="l")}
|{g(n="k", a=1)} |{g(n="k", a=1)}

View file

@ -1,10 +1,10 @@
:$ a :$ a
|a |a
@1 return(1)
:$ b :$ b
|b |b
@() return(())
|{a! & b!} = a b () |{a! & b!} = a b ()

View file

@ -1,5 +1,5 @@
:i = 0 :i = 0
(i += 1; i <= 10) ~? (| {i}\n)! while($()(i += 1; i <= 10), $| {i}\n |!)
|{i} |{i}

View file

@ -1,4 +1,4 @@
:$ f(a, b, c) :$ f(a, b, c)
@a + b + c return(a + b + c)
|{f("a", "b", "c")} = {f(a="a", b="b", c="c")} = {f(c="c", a="a", b="b")} |{f("a", "b", "c")} = {f(a="a", b="b", c="c")} = {f(c="c", a="a", b="b")}

View file

@ -1,19 +1,19 @@
1 ~ if(1)
|yes |yes
() ~ if(())
|no |no
~ else!
|nope |nope
1 ~ if(1)
|niet |niet
() ~ if(())
|still no |still no
~ else!
|nein |nein
() ~ if(())
|nah |nah
~ else!
|ye |ye
~ else!
|da |da

View file

@ -1,18 +1,18 @@
1 ~ if(1)
|a |a
|b |b
1 ~ if(1)
|c |c
|d |d
1 ~ if(1)
|e |e
| f |> () | f |> ()
:@choice = 1 :@choice = 1
1 ~ if(1)
|g |g
| h |> () | h |> ()

View file

@ -1,4 +1,4 @@
:$ f(a, b, c="c") :$ f(a, b, c="c")
@a + b + c return(a + b + c)
|{f("a", "b")} = {f("a", "b", "c")} = {f(b="b", a="a")} |{f("a", "b")} = {f("a", "b", "c")} = {f(b="b", a="a")}

View file

@ -1,7 +1,7 @@
:f = "f"!script($_) :f = "f"!script
"a":"a" # "a":"a" #
|a |a
1 ~ "x":"x" # if(1, $()("x":"x" # _))
"b":"b" # "b":"b" #
#p!checkpoint($_) #p!checkpoint($_)
"c":"c"# |b "c":"c"# |b

View file

@ -45,7 +45,7 @@ g!
g!from(#p) g!from(#p)
:h = "h"!script($_) :h = "h"!script($_)
1 ~ if(1)
| a |> | a |>
|-> a |-> a
#p!checkpoint #p!checkpoint
@ -76,7 +76,7 @@ h!from(#p)
|-> ab |-> ab
| b |> | b |>
|-> b |-> b
1 ~ if(1)
| c |> | c |>
|-> c |-> c

View file

@ -1,8 +1,8 @@
:f = "f"!script($_) :f = "f"!script($_)
1 ~ if(1)
#p!checkpoint #p!checkpoint
|x |x
~ else!
|y |y
f! f!
@ -10,10 +10,10 @@ f!
f!from(#p) f!from(#p)
:g = "g"!script($_) :g = "g"!script($_)
() ~ if(())
#p!checkpoint #p!checkpoint
|x |x
~ else!
|y |y
g! g!

View file

@ -1,13 +1,13 @@
:$ fn :$ fn
:i=0 :i=0
@ return(_)
i=50 i=50
i i
| {fn!} = 50 | {fn!} = 50
:$ g :$ g
@ return(_)
@3 return(3)
| {g!} = 3 | {g!} = 3

View file

@ -1,10 +1,10 @@
:$ f :$ f
| a |> | a |>
| x | x
@1 return(1)
| y | y
@2 return(2)
f! == 2 ~ if(f! == 2)
:@choice = 1 :@choice = 1
| Yes. | Yes.

View file

@ -12,7 +12,7 @@
|CHECK |CHECK
merge branch! merge branch!
n < 1 ~ if(n < 1)
|REC |REC
n += 1 n += 1

View file

@ -12,7 +12,7 @@
|CHECK |CHECK
merge branch! merge branch!
n < 1 ~ if(n < 1)
|REC |REC
n += 1 n += 1

View file

@ -10,7 +10,7 @@
|CHECK |CHECK
merge branch! merge branch!
n < 1 ~ if(n < 1)
|REC |REC
n += 1 n += 1

View file

@ -12,7 +12,7 @@
|CHECK |CHECK
merge branch! merge branch!
n < 1 ~ if(n < 1)
|REC |REC
n += 1 n += 1

View file

@ -12,7 +12,7 @@
|CHECK |CHECK
merge branch! merge branch!
n < 1 ~ if(n < 1)
|REC |REC
n += 1 n += 1

View file

@ -10,7 +10,7 @@
|CHECK |CHECK
merge branch! merge branch!
n < 1 ~ if(n < 1)
|REC |REC
n += 1 n += 1

View file

@ -1,4 +1,4 @@
1 # 1 #
|foo |foo
1 ~ "b":[1,2] # if(1, $()("b":[1,2] # _))
1 ~ "a":[2,3] # | bar if(1, $()("a":[2,3] # | bar))

View file

@ -1,5 +1,5 @@
:$ f :$ f
@"b" return("b")
|a {5 # |{f!}} c |a {5 # |{f!}} c

View file

@ -1,8 +1,8 @@
:$ f :$ f
1 # | lol 1 # | lol
@2 # |d return(2 # |d)
:a = |a {f!} {3#|t} b :a = |a {f!} {3#|t} b
@a return(a)

View file

@ -1,8 +1,8 @@
:$ f :$ f
|lol |lol
@|d return(|d)
:a = |a {f!} b :a = |a {f!} b
@a return(a)

View file

@ -9,7 +9,7 @@
1 # | left 1 # | left
| Surprise choice! |> | Surprise choice! |>
| ok2 | ok2
@" joystick" return(" joystick")
| Press {jump button!} to jump. | Press {jump button!} to jump.

View file

@ -1,12 +1,12 @@
:$ jump button :$ jump button
1 # | A 1 # | A
@ return!
:$ move axis :$ move axis
1 # | left 1 # | left
@" joystick" return(" joystick")
| Press {jump button!} to jump. | Press {jump button!} to jump.

View file

@ -1,9 +1,9 @@
:$ jump button :$ jump button
@1 # | A return(1 # | A)
:$ move axis :$ move axis
2 # | left 2 # | left
@" joystick" return(" joystick")
| Press {jump button!} to jump. | Press {jump button!} to jump.

View file

@ -1,8 +1,8 @@
:$ -f :$ -f
@"generic minus" return("generic minus")
:$ -f::string :$ -f::string
@"minus "+f return("minus "+f)
|{-5} |{-5}

View file

@ -1,6 +1,6 @@
: x = "x"!script($_) : x = "x"!script($_)
|a |a
run == 0 ~ |seen only once if(run == 0, $|seen only once)
|b |b
x! x!

View file

@ -0,0 +1,10 @@
:i = 0
while($i <= 10)
| {i}
if(i == 5)
break!
i += 1
|ok

View file

@ -0,0 +1,10 @@
:i = 0
while($i <= 5)
i += 1
if(i == 3)
continue!
| {i}
|ok

View file

@ -2,18 +2,18 @@
| Start with i={i}: | Start with i={i}:
i < 5 ~? while($i < 5)
| {i} | {i}
i += 1 i += 1
~ else!
| Loop not ran. | Loop not ran.
| Start with i={i}: | Start with i={i}:
i < 5 ~? while($i < 5)
| {i} | {i}
i += 1 i += 1
~ else!
| Loop not ran. | Loop not ran.

View file

@ -1,5 +1,5 @@
:i = 0 :i = 0
i <= 10 ~? while($i <= 10)
| {i} | {i}
i += 1 i += 1
@ -7,10 +7,10 @@ i <= 10 ~?
| return in loop: | return in loop:
i = 0 i = 0
i <= 10 ~? while($i <= 10)
| {i} | {i}
i == 5 ~ if(i == 5)
@() return!
i += 1 i += 1