Speed up the precedence state lookup

`PRECEDENCE.index(state)` is an O(n) operation, and the hash lookup is O(1)

For this, I could have easily just built the dict by hand and used `PRECEDENCE`, but I didn't want to clobber that variable incase someone out there is importing it for some other weird purpose. Better to play it safe. :)