123456789101112131415161718192021222324252627282930 |
- / :`i$"A"; // 65
- / :`i$"Z"; // 90
- / :`i$"0"; // 48
- / :`i$"9"; // 57
- / :`i$":"; // 58
- / :`i$"$"; // 36
- testAtZ: { i:`i$x; $[(i>64) & (i<91);1;0] };
- test0t9: { i:`i$x; $[(i>47) & (i<58);1;0] };
- testcol: { i:`i$x; $[i=58;1;0] };
- testend: { i:`i$x; $[i=36;1;0] };
- s0: ((testAtZ; 1);(test0t9; 2));
- s1: ((test0t9; 2);(testcol; 3));
- s2: ((testend; 7); (testcol;5));
- s3: (,(testAtZ; 5));
- s4: ((testAtZ; 5); (test0t9; 6));
- s5: (,(testend; 7));
- s6: (,(testend; 7));
- s7: (({`0:"SUCCESS"};7));
- // 7 is done
- states:: (s0;s1;s2;s3;s4;s5;s6;s7);
- i: 1;
- run: {[str] str,:"$"; `0:str; s: 0; :o:s {[s;c] r:{t: x[0][y]; o:$[t;x[1];0]; o}[;c]'states[s]; `0:`k@(s;c;ns); ns:states@(&r); ns}\str;};
- // todo: don't be using $
- // prepare for matching pattern and returning the start index and length
- test: "A:A";
- run[test]
|