(Frag f1, Frag f2)
| 90 | |
| 91 | // Given fragments a and b, returns ab; a|b |
| 92 | private Frag cat(Frag f1, Frag f2) { |
| 93 | // concat of failure is failure |
| 94 | if (f1.i == 0 || f2.i == 0) { |
| 95 | return fail(); |
| 96 | } |
| 97 | // TODO(rsc): elide nop |
| 98 | prog.patch(f1.out, f2.i); |
| 99 | return new Frag(f1.i, f2.out, f1.nullable && f2.nullable); |
| 100 | } |
| 101 | |
| 102 | // Given fragments for a and b, returns fragment for a|b. |
| 103 | private Frag alt(Frag f1, Frag f2) { |