Add parsing function to sr_parser.

This also changes the internal method signature for best_transition to
allow for checking legality of transitions when requesting the next
transition to take.