compileValueSelector: remove unused argument
Refactor compileValueSelector

Pull out equality and regexp. Nothing else changes.
Refactor equality to use new lookup function