nl_tokens: cbrdissect - determine backref subexpression matches
pl_tokens: private boolean cbrdissect ( RuntimeSubexpression t , int begin , int end ) { int i ; int n = t . number ; int len ; int paren ; int p ; int stop ; int <mask> = t . min ; int max = t . max ; assert t . op == ' ' ; assert n >= 0 ; //TODO: could this get be out of range? if ( match . get ( n ) == null ) { return false ; } paren = match . get ( n ) . start ; len = match . get ( n ) . end - match . get ( n ) . start ; /* no room to maneuver -- retries are pointless */ if ( 0 != mem [ t . retry ] ) { return false ; } mem [ t . retry ] = 1 ; /* special-case zero-length string */ if ( len == 0 ) { return begin == end ; } /* and too-short string */ assert end >= begin ; if ( ( end - begin ) < len ) { return false ; } stop = end - len ; /* count occurrences */ i = 0 ; for ( p = begin ; p <= stop && ( i < max || max == Compiler . INFINITY ) ; p += len ) { // paren is index of if ( g . compare . compare ( data , paren , p , len ) != 0 ) { break ; } i ++ ; } /* and sort it out */ if ( p != end ) { /* didn't consume all of it */ return false ; } return min <= i && ( i <= max || max == Compiler . INFINITY ) ; }