src/main/java/com/basistech/tclre/Runtime.java
private boolean cdissect(RuntimeSubexpression t, int begin, int end) {

        assert t != null;

        switch (t.op) {
        case '=':       /* terminal node */
            assert t.left == null && t.right == null;
            return true;    /* no action, parent did the work */

        case '|':       /* alternation */
            assert t.left != null;
            return caltdissect(t, begin, end);

        case 'b':       /* back ref -- shouldn't be calling us! */
            assert t.left == null && t.right == null;
            return cbrdissect(t, begin, end);

        case '.':       /* concatenation */
            assert t.left != null && t.right != null;
            return ccondissect(t, begin, end);

        case '(':       /* capturing */
            assert t.left != null && t.right == null;
            assert t.number > 0;
            boolean cdmatch = cdissect(t.left, begin, end);
            if (cdmatch) {
                subset(t, begin, end);
            }
            return cdmatch;

        default:
            throw new RuntimeException("Impossible op");
        }
    }
private boolean cdissect(RuntimeSubexpression t, int begin, int end) {

        assert t != null;

        switch (t.op) {
        case '=':       /* terminal node */
            assert t.left == null && t.right == null;
            return true;    /* no action, parent did the work */

        case '|':       /* alternation */
            assert t.left != null;
            return caltdissect(t, begin, end);

        case 'b':       /* back ref -- shouldn't be calling us! */
            assert t.left == null && t.right == null;
            return cbrdissect(t, begin, end);

        case '.':       /* concatenation */
            assert t.left != null && t.right != null;
            return ccondissect(t, begin, end);

        case '(':       /* capturing */
            assert t.left != null && t.right == null;
            assert t.number > 0;
            boolean cdmatch = cdissect(t.left, begin, end);
            if (cdmatch) {
                subset(t, begin, end);
            }
            return cdmatch;

        default:
            throw new RuntimeException("Impossible op");
        }
    }
private boolean cdissect ( RuntimeSubexpression t , int begin , int end ) { assert t != null ; switch ( t . op ) { case ' ' : /* terminal node */ assert t . left == null && t . right == null ; return true ; /* no action, parent did the work */ case ' ' : /* alternation */ assert t . left != null ; return caltdissect ( t , begin , end ) ; case ' ' : /* back ref -- shouldn't be calling us! */ assert t . left == null && t . right == null ; return cbrdissect ( t , begin , end ) ; case ' ' : /* concatenation */ assert t . left != null && t . right != null ; return ccondissect ( t , begin , end ) ; case ' ' : /* capturing */ assert t . left != null && t . right == null ; assert t . number > 0 ; boolean cdmatch = cdissect ( t . left , begin , end ) ; if ( cdmatch ) { subset ( t , begin , end ) ; } return cdmatch ; default : throw new RuntimeException ( "Impossible op" ) ; } }
cdissect - determine subexpression matches (with complications)
The retry memory stores the offset of the trial midpoint from begin,
plus 1 so that 0 uniquely means "clean slate".
cdissect - determine subexpression matches ( with complications ) The retry memory stores the offset of the trial midpoint from begin plus 1 so that 0 uniquely means clean slate .