mirror of
https://github.com/ParkerTenBroeck/coroutines.git
synced 2026-06-07 05:08:51 -04:00
separated functionality of generator state machine builders into separate classes
This commit is contained in:
parent
10d07e2c80
commit
c3cb7cb884
7 changed files with 449 additions and 285 deletions
|
|
@ -8,6 +8,23 @@ public class Main implements Runnable {
|
|||
|
||||
@Override
|
||||
public void run() {
|
||||
await();
|
||||
// lexer();
|
||||
}
|
||||
|
||||
void await(){
|
||||
var gen = Examples.awaitTest(10);
|
||||
while(true) {
|
||||
var next = gen.next();
|
||||
if(next instanceof Gen.Yield(var e)) System.out.println(e);
|
||||
else if(next instanceof Gen.Ret(var ret)){
|
||||
System.out.println(ret);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void lexer(){
|
||||
var gen = Lexer.parse("f7(x,y,z,w, u,v, othersIg) = v-(x*y+y+ln(z)^2*sin(z*pi/2))/(w*u)+sqrt(othersIg*120e-1)");
|
||||
// var gen = Examples.test(new double[]{1,2,3,4});
|
||||
while(gen.next() instanceof Gen.Yield(var tok)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue