Refactor bridge_replace in lox-library crate
This refactor tackles the bridge_replace
function in the lox library. I noticed a lot of code duplication in it while looking at some unrelated changes in !129 (merged). There are no functional changes to this function or the library, just refactoring and code quality improvements.