summaryrefslogtreecommitdiff
path: root/src/test/java/com/seaofnodes/simple/spill/Chapter23Test-testMethod.smp
blob: ced649e3364aefd1175af41d5baa842e70053120 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// A hypothetical scanner class
struct _Scan {
    int !x;
    u8[~] buf;
    new _Scan={ u8[~] b -> buf=b; };
    // Skip whitespace
    val skip = { ->
        while( buf[x] <= ' ' )
            x++;
    };
    val require = { u8 ch ->
        skip();
        buf[x++]==ch;
    };
};
!_Scan !s = new _Scan("  [1,2]");
return s.require('[');