added an option to redefine control structures
This commit is contained in:
5
tests/custom_control_structures.expected
Normal file
5
tests/custom_control_structures.expected
Normal file
@@ -0,0 +1,5 @@
|
||||
11
|
||||
22
|
||||
33
|
||||
5
|
||||
3
|
||||
36
tests/custom_control_structures.sl
Normal file
36
tests/custom_control_structures.sl
Normal file
@@ -0,0 +1,36 @@
|
||||
import stdlib/stdlib.sl
|
||||
import stdlib/control.sl
|
||||
|
||||
word main
|
||||
1 if
|
||||
11 puti cr
|
||||
else
|
||||
99 puti cr
|
||||
end
|
||||
|
||||
0 if
|
||||
99 puti cr
|
||||
else
|
||||
22 puti cr
|
||||
end
|
||||
|
||||
0 if
|
||||
500 puti cr
|
||||
else 1 if
|
||||
33 puti cr
|
||||
else
|
||||
44 puti cr
|
||||
end
|
||||
|
||||
0
|
||||
5 for
|
||||
1 +
|
||||
end
|
||||
puti cr
|
||||
|
||||
0
|
||||
while dup 3 < do
|
||||
1 +
|
||||
end
|
||||
puti cr
|
||||
end
|
||||
1
tests/i_non_compile_time.compile.expected
Normal file
1
tests/i_non_compile_time.compile.expected
Normal file
@@ -0,0 +1 @@
|
||||
[error] word 'i' is compile-time only and cannot be used at runtime while emitting 'main'
|
||||
4
tests/i_non_compile_time.meta.json
Normal file
4
tests/i_non_compile_time.meta.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"expect_compile_error": true,
|
||||
"description": "'i' is compile-time only and rejected in runtime code"
|
||||
}
|
||||
8
tests/i_non_compile_time.sl
Normal file
8
tests/i_non_compile_time.sl
Normal file
@@ -0,0 +1,8 @@
|
||||
import stdlib/stdlib.sl
|
||||
|
||||
word main
|
||||
0
|
||||
3 for
|
||||
i puti cr
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user