• Caleb Spare's avatar
    regexp: fix one-pass compilation · e36bf614
    Caleb Spare authored
    The one-pass transformation is structured as a search over the input
    machine for conditions that violate the one-pass requisites. At each
    iteration, we should fully explore all non-input paths that proceed from
    the current instruction; this is implemented via recursive check calls.
    But when we reach instructions that demand input (InstRune*), these
    should be put onto the search queue.
    
    Instead of searching this way, the routine previously (effectively)
    proceeded through the machine one instruction at a time until finding an
    Inst{Match,Fail,Rune*}, calling check on each instruction. This caused
    bug #11905, where the transformation stopped before rewriting all
    InstAlts as InstAltMatches.
    
    Further, the check function unnecessarily recurred on InstRune*
    instructions. (I believe this helps to mask the above bug.)
    
    This change also deletes some unused functions and duplicate test cases.
    
    Fixes #11905.
    
    Change-Id: I5b0b26efea3d3bd01c7479a518b5ed1b886701cd
    Reviewed-on: https://go-review.googlesource.com/17195Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
    e36bf614
Name
Last commit
Last update
..
syntax Loading commit data...
testdata Loading commit data...
all_test.go Loading commit data...
backtrack.go Loading commit data...
example_test.go Loading commit data...
exec.go Loading commit data...
exec2_test.go Loading commit data...
exec_test.go Loading commit data...
find_test.go Loading commit data...
onepass.go Loading commit data...
onepass_test.go Loading commit data...
regexp.go Loading commit data...