Flexible and Efficient Grammar-Constrained Decoding