From 00af8285d1b778647bcf9729b2d6545b13834a95 Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Sun, 7 Jul 2019 14:49:42 +0200 Subject: [PATCH] :white:_check_mark: Upate examples --- examples/class_func_pointer.gw | 24 +++---- examples/complex/event.gw | 2 +- examples/complex/event2_1.gw | 4 +- examples/doc.gw | 2 +- examples/dtor.gw | 2 +- examples/float.gw | 114 +++++++++++++++---------------- examples/func_ptr.gw | 12 ++-- examples/int.gw | 78 ++++++++++----------- examples/math.gw | 6 +- examples/member.gw | 6 +- examples/op.gw | 8 +-- examples/shred.gw | 4 +- examples/static.gw | 6 +- examples/string.gw | 24 +++---- examples/switch.gw | 4 +- examples/tail_call.gw | 2 +- examples/typedef_array_extend.gw | 2 +- tests/bug/ugen.gw | 2 +- 18 files changed, 151 insertions(+), 151 deletions(-) diff --git a/examples/class_func_pointer.gw b/examples/class_func_pointer.gw index 92f47b64..a255fce9 100644 --- a/examples/class_func_pointer.gw +++ b/examples/class_func_pointer.gw @@ -1,32 +1,32 @@ fun void test() { <<< "member function." >>>; } class C { typedef void func_t(); -// typedef static void s_func_t(); +#! typedef static void s_func_t(); func_t func_p; -// static fun c_t s_func_p; -// static s_func_t s_ptr; +#! static fun c_t s_func_p; +#! static s_func_t s_ptr; fun void test() { <<< "member function." >>>; } fun void test2() { <<< "member function variant." >>>; } -// fun static void s_test() { <<< "member fun." >>>; } -// test @=> func_p; -// test @=> s_ptr; +#! fun static void s_test() { <<< "member fun." >>>; } +#! test @=> func_p; +#! test @=> s_ptr; -// those are forbidden -//func_p(); -//this.func_p(); +#! those are forbidden +#!func_p(); +#!this.func_p(); test2 @=> func_p; -//func_p(); +#!func_p(); test(); -//<<< test >>>;//, func_p >>>; +#!<<< test >>>;//, func_p >>>; } C c; c.func_p(); -//test @=> c.s_func_p; +#!test @=> c.s_func_p; c.test @=> c.func_p; c.func_p(); c.test2 @=> c.func_p; diff --git a/examples/complex/event.gw b/examples/complex/event.gw index 82941075..84d2c536 100644 --- a/examples/complex/event.gw +++ b/examples/complex/event.gw @@ -1,6 +1,6 @@ Event e; spork {second => now; e.broadcast(); }; spork \{second => now; e.broadcast(); }(); -//2::second => now; +#!2::second => now; .2::second => now; e => now; diff --git a/examples/complex/event2_1.gw b/examples/complex/event2_1.gw index ae3715d1..686d0905 100644 --- a/examples/complex/event2_1.gw +++ b/examples/complex/event2_1.gw @@ -2,8 +2,8 @@ class global TestEvent { static Event e; } second => now; -//second => now; +#!second => now; <<< "base ", me >>>; -//TestEvent.e => now; +#!TestEvent.e => now; <<< "ok" >>>; second => now; diff --git a/examples/doc.gw b/examples/doc.gw index 47fea358..5610282a 100644 --- a/examples/doc.gw +++ b/examples/doc.gw @@ -1,6 +1,6 @@ Machine.add("examples/int.gw"); Machine.compile("int i;<<< 120 >>>;"); -//Machine.compile("int i[error];"); +#!Machine.compile("int i[error];"); <<< Machine.check("12 => int i; <<< i >>>") >>>; Machine.check("int i[error];"); diff --git a/examples/dtor.gw b/examples/dtor.gw index 98454a19..4c3e45f5 100644 --- a/examples/dtor.gw +++ b/examples/dtor.gw @@ -5,6 +5,6 @@ class C C c; C d; -//me.yield(); +#!me.yield(); <<< "end of dtor test." >>>; <<< c," ", d >>>; diff --git a/examples/float.gw b/examples/float.gw index a066e832..720ada76 100644 --- a/examples/float.gw +++ b/examples/float.gw @@ -1,264 +1,264 @@ -// coverage for 'float'. (generated by util/coverage.sh) +#! coverage for 'float'. (generated by util/coverage.sh) float a; -//testing operator for float and float +#!testing operator for float and float { float variable1; float variable2; <<< variable1=variable2 >>>; } -//testing operator for float and float +#!testing operator for float and float { float variable1; float variable2; <<< variable1+variable2 >>>; } -//testing operator for float and float +#!testing operator for float and float { float variable1; float variable2; <<< variable1-variable2 >>>; } -//testing operator for float and float +#!testing operator for float and float { float variable1; float variable2; <<< variable1*variable2 >>>; } -//testing operator for float and float +#!testing operator for float and float { float variable1; float variable2; <<< variable1/variable2 >>>; } -//testing operator for float and float +#!testing operator for float and float { float variable1; float variable2; <<< variable1&&variable2 >>>; } -//testing operator for float and float +#!testing operator for float and float { float variable1; float variable2; <<< variable1||variable2 >>>; } -//testing operator for float and float +#!testing operator for float and float { float variable1; float variable2; <<< variable1==variable2 >>>; } -//testing operator for float and float +#!testing operator for float and float { float variable1; float variable2; <<< variable1!=variable2 >>>; } -//testing operator for float and float +#!testing operator for float and float { float variable1; float variable2; <<< variable1>variable2 >>>; } -//testing operator for float and float +#!testing operator for float and float { float variable1; float variable2; <<< variable1>=variable2 >>>; } -//testing operator for float and float +#!testing operator for float and float { float variable1; float variable2; <<< variable1>>; } -//testing operator for float and float +#!testing operator for float and float { float variable1; float variable2; <<< variable1<=variable2 >>>; } -//testing operator for and float +#!testing operator for and float { float variable2; <<< -variable2 >>>; } -//testing operator for and int +#!testing operator for and int { int variable2; <<< !variable2 >>>; } -//testing operator for float and float +#!testing operator for float and float { float variable1; float variable2; <<< variable1=>variable2 >>>; } -//testing operator for float and float +#!testing operator for float and float { float variable1; float variable2; <<< variable1+=>variable2 >>>; } -//testing operator for float and float +#!testing operator for float and float { float variable1; float variable2; <<< variable1-=>variable2 >>>; } -//testing operator for float and float +#!testing operator for float and float { float variable1; float variable2; <<< variable1*=>variable2 >>>; } -//testing operator for float and float +#!testing operator for float and float { 1 => float variable1; 1 => float variable2; <<< variable1/=>variable2 >>>; } -//testing operator for int and float +#!testing operator for int and float { int variable1; float variable2; <<< variable1=variable2 >>>; } -//testing operator for int and float +#!testing operator for int and float { int variable1; float variable2; <<< variable1+variable2 >>>; } -//testing operator for int and float +#!testing operator for int and float { int variable1; float variable2; <<< variable1-variable2 >>>; } -//testing operator for int and float +#!testing operator for int and float { int variable1; float variable2; <<< variable1*variable2 >>>; } -//testing operator for int and float +#!testing operator for int and float { int variable1; float variable2; <<< variable1/variable2 >>>; } -//testing operator for int and float +#!testing operator for int and float { int variable1; float variable2; <<< variable1&&variable2 >>>; } -//testing operator for int and float +#!testing operator for int and float { int variable1; float variable2; <<< variable1||variable2 >>>; } -//testing operator for int and float +#!testing operator for int and float { int variable1; float variable2; <<< variable1==variable2 >>>; } -//testing operator for int and float +#!testing operator for int and float { int variable1; float variable2; <<< variable1!=variable2 >>>; } -//testing operator for int and float +#!testing operator for int and float { int variable1; float variable2; <<< variable1>variable2 >>>; } -//testing operator for int and float +#!testing operator for int and float { int variable1; float variable2; <<< variable1>=variable2 >>>; } -//testing operator for int and float +#!testing operator for int and float { int variable1; float variable2; <<< variable1>>; } -//testing operator for int and float +#!testing operator for int and float { int variable1; float variable2; <<< variable1<=variable2 >>>; } -//testing operator for int and float +#!testing operator for int and float { int variable1; float variable2; <<< variable1=>variable2 >>>; } -//testing operator for int and float +#!testing operator for int and float { int variable1; float variable2; <<< variable1+=>variable2 >>>; } -//testing operator for int and float +#!testing operator for int and float { int variable1; float variable2; <<< variable1-=>variable2 >>>; } -//testing operator for int and float +#!testing operator for int and float { int variable1; float variable2; <<< variable1*=>variable2 >>>; } -//testing operator for int and float +#!testing operator for int and float { int variable1; 1 => float variable2; @@ -266,28 +266,28 @@ float a; } -//testing operator for float and int +#!testing operator for float and int { float variable1; int variable2; <<< variable1=variable2 >>>; } -//testing operator for float and int +#!testing operator for float and int { float variable1; int variable2; <<< variable1+variable2 >>>; } -//testing operator for float and int +#!testing operator for float and int { float variable1; int variable2; <<< variable1-variable2 >>>; } -//testing operator for float and int +#!testing operator for float and int { float variable1; int variable2; @@ -295,98 +295,98 @@ float a; } -//testing operator for float and int +#!testing operator for float and int { float variable1; int variable2; <<< variable1/variable2 >>>; } -//testing operator for float and int +#!testing operator for float and int { float variable1; int variable2; <<< variable1&&variable2 >>>; } -//testing operator for float and int +#!testing operator for float and int { float variable1; int variable2; <<< variable1||variable2 >>>; } -//testing operator for float and int +#!testing operator for float and int { float variable1; int variable2; <<< variable1==variable2 >>>; } -//testing operator for float and int +#!testing operator for float and int { float variable1; int variable2; <<< variable1!=variable2 >>>; } -//testing operator for float and int +#!testing operator for float and int { float variable1; int variable2; <<< variable1>variable2 >>>; } -//testing operator for float and int +#!testing operator for float and int { float variable1; int variable2; <<< variable1>=variable2 >>>; } -//testing operator for float and int +#!testing operator for float and int { float variable1; int variable2; <<< variable1>>; } -//testing operator for float and int +#!testing operator for float and int { float variable1; int variable2; <<< variable1<=variable2 >>>; } -//testing operator for float and int +#!testing operator for float and int { float variable1; int variable2; <<< variable1=>variable2 >>>; } -//testing operator for float and int +#!testing operator for float and int { float variable1; int variable2; <<< variable1+=>variable2 >>>; } -//testing operator for float and int +#!testing operator for float and int { float variable1; int variable2; <<< variable1-=>variable2 >>>; } -//testing operator for float and int +#!testing operator for float and int { float variable1; int variable2; <<< variable1*=>variable2 >>>; } -//testing operator for float and int +#!testing operator for float and int { 1 => float variable1; 1 => int variable2; diff --git a/examples/func_ptr.gw b/examples/func_ptr.gw index 80fc7126..9a0e3832 100644 --- a/examples/func_ptr.gw +++ b/examples/func_ptr.gw @@ -1,20 +1,20 @@ -// define a fun pointer type +#! define a fun pointer type typedef void Test() -// define a few funs +#! define a few funs fun void test1(){ <<< "test" >>>; }; fun void test2(){ <<< "another test" >>>; }; fun void test3(){ <<< "yet another test" >>>; }; -// create a fun pointer instance +#! create a fun pointer instance Test test; -// assign it a fun +#! assign it a fun test1 @=> test; -// test it +#! test it test(); -// ... +#! ... test2 @=> test; test(); diff --git a/examples/int.gw b/examples/int.gw index 72c58aec..82d8f3a5 100644 --- a/examples/int.gw +++ b/examples/int.gw @@ -1,255 +1,255 @@ -// coverage for 'int'. (generated by util/coverage.sh) +#! coverage for 'int'. (generated by util/coverage.sh) int a; -//testing operator for int and int +#!testing operator for int and int { int variable1; int variable2; <<< variable1=variable2 >>>; } -//testing operator for int and int +#!testing operator for int and int { int variable1; int variable2; <<< variable1+variable2 >>>; } -//testing operator for int and int +#!testing operator for int and int { int variable1; int variable2; <<< variable1-variable2 >>>; } -//testing operator for int and int +#!testing operator for int and int { int variable1; int variable2; <<< variable1*variable2 >>>; } -//testing operator for int and int +#!testing operator for int and int { int variable1; 1 => int variable2; <<< variable1/variable2 >>>; } -//testing operator for int and int +#!testing operator for int and int { int variable1; 1 => int variable2; <<< variable1%variable2 >>>; } -//testing operator for int and int +#!testing operator for int and int { int variable1; int variable2; <<< variable1&&variable2 >>>; } -//testing operator for int and int +#!testing operator for int and int { int variable1; int variable2; <<< variable1||variable2 >>>; } -//testing operator for int and int +#!testing operator for int and int { int variable1; int variable2; <<< variable1==variable2 >>>; } -//testing operator for int and int +#!testing operator for int and int { int variable1; int variable2; <<< variable1!=variable2 >>>; } -//testing operator for Object and +#!testing operator for Object and { Object @variable1; <<< variable1!= null >>>; } -//testing operator for int and int +#!testing operator for int and int { int variable1; int variable2; <<< variable1>variable2 >>>; } -//testing operator for int and int +#!testing operator for int and int { int variable1; int variable2; <<< variable1>=variable2 >>>; } -//testing operator for int and int +#!testing operator for int and int { int variable1; int variable2; <<< variable1>>; } -//testing operator for int and int +#!testing operator for int and int { int variable1; int variable2; <<< variable1<=variable2 >>>; } -//testing operator for int and int +#!testing operator for int and int { int variable1; int variable2; <<< variable1>>variable2 >>>; } -//testing operator for int and int +#!testing operator for int and int { int variable1; int variable2; <<< variable1<>>; } -//testing operator for int and int +#!testing operator for int and int { int variable1; int variable2; <<< variable1&variable2 >>>; } -//testing operator for int and int +#!testing operator for int and int { int variable1; int variable2; <<< variable1|variable2 >>>; } -//testing operator for int and int +#!testing operator for int and int { int variable1; int variable2; <<< variable1^variable2 >>>; } -//testing operator for and int +#!testing operator for and int { int variable2; <<< -variable2 >>>; } -//testing operator for and int +#!testing operator for and int { int variable2; <<< !variable2 >>>; } -//testing operator for int and +#!testing operator for int and { int variable1; <<< variable1++ >>>; } -//testing operator for and int +#!testing operator for and int { int variable2; <<< ++variable2 >>>; } -//testing operator for int and +#!testing operator for int and { int variable1; <<< variable1-- >>>; } -//testing operator for and int +#!testing operator for and int { int variable2; <<< --variable2 >>>; } -//testing operator for int and int +#!testing operator for int and int { int variable1; int variable2; <<< variable1=>variable2 >>>; } -//testing operator for int and int +#!testing operator for int and int { int variable1; int variable2; <<< variable1+=>variable2 >>>; } -//testing operator for int and int +#!testing operator for int and int { int variable1; int variable2; <<< variable1-=>variable2 >>>; } -//testing operator for int and int +#!testing operator for int and int { int variable1; int variable2; <<< variable1*=>variable2 >>>; } -//testing operator for int and int +#!testing operator for int and int { 1 => int variable1; 1 => int variable2; <<< variable1/=>variable2 >>>; } -//testing operator for int and int +#!testing operator for int and int { 1 => int variable1; int variable2; <<< variable1%=>variable2 >>>; } -//testing operator for int and int +#!testing operator for int and int { int variable1; int variable2; <<< variable1<<=>variable2 >>>; } -//testing operator for int and int +#!testing operator for int and int { int variable1; int variable2; <<< variable1>>=>variable2 >>>; } -//testing operator for int and int +#!testing operator for int and int { int variable1; int variable2; <<< variable1&=>variable2 >>>; } -//testing operator for int and int +#!testing operator for int and int { int variable1; int variable2; <<< variable1|=>variable2 >>>; } -//testing operator for int and int +#!testing operator for int and int { int variable1; int variable2; <<< variable1^=>variable2 >>>; } -// testing cmp +#! testing cmp ~1; diff --git a/examples/math.gw b/examples/math.gw index 38f1b4a3..63c56bac 100644 --- a/examples/math.gw +++ b/examples/math.gw @@ -17,7 +17,7 @@ <<< Math.sgn(-1.0) >>>; <<< Math.hypot(4,5) >>>; -// sin +#! sin <<< Math.sin(1) >>>; <<< Math.sin(1.0) >>>; <<< Math.sinh(1) >>>; @@ -27,7 +27,7 @@ <<< Math.asinh(1) >>>; <<< Math.asinh(1.0) >>>; -// cos +#! cos <<< Math.cos(1) >>>; <<< Math.cos(1.0) >>>; <<< Math.cosh(1) >>>; @@ -37,7 +37,7 @@ <<< Math.acosh(1) >>>; <<< Math.acosh(1.0) >>>; -// tan +#! tan <<< Math.tan(1) >>>; <<< Math.tan(1.0) >>>; <<< Math.tanh(1) >>>; diff --git a/examples/member.gw b/examples/member.gw index 073d3793..6c041583 100644 --- a/examples/member.gw +++ b/examples/member.gw @@ -16,14 +16,14 @@ class C } C c; -// read members +#! read members <<< c.i, c.c, c.f, c.v, c.w, c.o >>>; -// call fun members +#! call fun members <<< c.m_i(), " ", c.m_f(), " ", c.m_c(), " ", c.m_v(), " ", c.m_w(), " ", c.m_o() >>>; -// write members +#! write members <<< 12 => c.i >>>; <<< 1.2 => c.f >>>; <<< #(0.1, 2.3) => c.c >>>; diff --git a/examples/op.gw b/examples/op.gw index f439d691..54976283 100644 --- a/examples/op.gw +++ b/examples/op.gw @@ -1,4 +1,4 @@ -//! test operator +#!! test operator operator => void (Object o, int i) { <<< o, " ", i, " success" >>>; @@ -8,17 +8,17 @@ class C { Object @ref; } -//! assign object to C.ref +#!! assign object to C.ref operator => void (Object o, C c) { o @=> c.ref; <<< "success" >>>; } -//operator int plusplus(null d, int i){} +#!operator int plusplus(null d, int i){} int i; Object o; <<< o, " ", i >>>; 12 => i; -//o => i; +#!o => i; C c; o => c; diff --git a/examples/shred.gw b/examples/shred.gw index 99c6db53..29c873c1 100644 --- a/examples/shred.gw +++ b/examples/shred.gw @@ -9,6 +9,6 @@ for (int i; i < me.args(); i++) <<< "arg ", i, me.arg(i) >>>; <<< me.dir(), " ", me.path() >>>; <<< me.code_dir(), " ", me.code_path() >>>; -//me.exit(); -// call to non existant arg +#!me.exit(); +#! call to non existant arg <<< me.arg(-1) >>>; diff --git a/examples/static.gw b/examples/static.gw index 66415374..8e584f6d 100644 --- a/examples/static.gw +++ b/examples/static.gw @@ -22,13 +22,13 @@ class C fun static Object _o() { return o; } } -// read members +#! read members <<< C.i, C.c, C.f, C.v, C.w, C.o >>>; -// call fun members +#! call fun members <<< C._i(), " ", C._f(), " ", C._c(), " ", C._v(), " ", C._w(), " ", C._o() >>>; -// write members +#! write members <<< 12 => C.i >>>; <<< 1.2 => C.f >>>; <<< #(0.1, 2.3) => C.c >>>; diff --git a/examples/string.gw b/examples/string.gw index 605cdfa0..31f93e35 100644 --- a/examples/string.gw +++ b/examples/string.gw @@ -32,26 +32,26 @@ s.substring(2); <<< "su".replace(1, "t") >>>; <<< "su".replace(1, 2, "turlututu") >>>; <<< " su ".charAt(1, 'n') >>>; -//null @=> s; +#!null @=> s; <<< 1 => s >>>; <<< 1.0 => s >>>; <<< #(2,1) => s >>>; <<< %(2,1) => s >>>; <<< @(2,1,0) => s >>>; <<< @(2,1,0,-1) => s >>>; -<<< "test" => s >>>; // new -<<< "test" => s >>>; // new +<<< "test" => s >>>; #! new +<<< "test" => s >>>; #! new <<< s >>>; -<<< null => s >>>; //test me +<<< null => s >>>; #!test me <<< o => s >>>; <<< o >>>; -// look at me!!! -<<< o => s >>>; // hang . grrr ... -<<< "test" + "another test" >>>; // mem leak +#! look at me!!! +<<< o => s >>>; #! hang . grrr ... +<<< "test" + "another test" >>>; #! mem leak <<< "1".toInt() >>>; <<< "1".toFloat() >>>; -//me.exit(); +#!me.exit(); { (1 + s) @=> string @str; } { (2.0 +s) @=> string @str; } @@ -59,7 +59,7 @@ s.substring(2); { (%(2,1) + s) @=> string @str; } { (@(2,1, 0) + s) @=> string @str; } { (@(2,1, 0, -1) + s) @=> string @str; } -//{ ("test" + s) @=> string @str; } // leak +#!{ ("test" + s) @=> string @str; } // leak <<< 11 +=> s >>>; @@ -69,9 +69,9 @@ s.substring(2); <<< @(22,11,11) +=> s >>>; <<< @(22,11,11,-11) +=> s >>>; <<< o +=> s >>>; -<<< "test" + s >>>; // also leak -<<< null +=> s >>>; // also hang -<<< "test" +=> s >>>; // test me +<<< "test" + s >>>; #! also leak +<<< null +=> s >>>; #! also hang +<<< "test" +=> s >>>; #! test me <<< "test" == "test" >>>; <<< "test" != "test" >>>; <<< "test" == "test1" >>>; diff --git a/examples/switch.gw b/examples/switch.gw index 4d626a4c..4b777ebd 100644 --- a/examples/switch.gw +++ b/examples/switch.gw @@ -15,5 +15,5 @@ fun void test(int i) { } 2 => i => test; -//1 => i => test; -//0 => i => test; +#!1 => i => test; +#!0 => i => test; diff --git a/examples/tail_call.gw b/examples/tail_call.gw index 6e3f1137..0a595ebd 100644 --- a/examples/tail_call.gw +++ b/examples/tail_call.gw @@ -1,6 +1,6 @@ fun void test(int i) { if(i == 2)return; -// if(i == 0)return; +#! if(i == 0)return; <<< i >>>; return test(--i + 3 - 4); } diff --git a/examples/typedef_array_extend.gw b/examples/typedef_array_extend.gw index 58390296..7a0ee9af 100644 --- a/examples/typedef_array_extend.gw +++ b/examples/typedef_array_extend.gw @@ -1,4 +1,4 @@ -//int i[]; +#!int i[]; typedef int[2] lol; class C extends lol { } C c; diff --git a/tests/bug/ugen.gw b/tests/bug/ugen.gw index 4329690a..f97efbab 100644 --- a/tests/bug/ugen.gw +++ b/tests/bug/ugen.gw @@ -1,5 +1,5 @@ UGen @u; -#!u.last(); // should fail => fails. +#!u.last(); #! should fail => fails. SinOsc s => Gain g => dac; for(-1 => int i;i < 6; i++) i => g.op; -- 2.43.0