Your implementation does handle it correctly though, but it requires some care when using parser generators :)