polserver/testsuite/escript/switch/switch16.src
Kevin Eady 593cfffb83
Add uninit, true, false keywords to grammar (#596)
* Update grammar

* Update expression handling for uninit

* update existing tests

* Add new tests

* Remove fullpath from escriptgrammar generation comment

* fix tests

* Update eScript guide

* Declare escript version 0x11

* Add core-changes

* Add `true` and `false` to grammar

* true/false implementation

* Fix existing tests

* Add new tests

* Update core changes

* add docs

* Fix BooleanValue::describe_to

* bool optimizations

* optimize uninit

* remove unused var assignments

* Update grammar for case labels for uninit, booleans

* Fix case label handling for uninit, true, false

* Tests

* Fix compiler version display v1.1700000017881393 -> v1.17

* optimize boolean binary operations

* fix unary boolean optimizer

* add boolean, uninit optimizer test

* Use new fmt lib apis

* Fix compiler warning

* really fix warning lol

* Add Executor[Module]::getParam for bools, FindSubstance test
2024-01-20 05:38:25 +01:00

28 lines
740 B
Text

const CONST_1 := 1;
const CONST_0 := 0;
const CONST_true := true;
const CONST_false := false;
const CONST_uninit := uninit;
const CONST_string := "string";
foreach value in array{1, 0, true, false, uninit, "string", struct{} }
case(value)
1: print("Got 1");
0: print("Got 0");
true: print("Got true");
false: print("Got false");
uninit: print("Got uninit");
"string": print("Got string");
default: print("Got default");
endcase
case(value)
CONST_1: print("Got 1");
CONST_0: print("Got 0");
CONST_true: print("Got true");
CONST_false: print("Got false");
CONST_uninit: print("Got uninit");
CONST_string: print("Got string");
default: print("Got default");
endcase
endforeach