chickadee » html-parser » make-string-reader/ci

make-string-reader/ci strprocedure

Generates a KMP reader that works on ports, returning the text read up until the search string (or the entire port if the search string isn't found). This is O(n) in the length of the string returned, as opposed to the find-string-from-port? in SSAX which uses backtracking for an O(nm) algorithm. This is hard-coded to case-insensitively match, since that's what we need for HTML. A more general utility would abstract the character matching predicate and possibly provide a limit on the length of the string read.