Fix memory leak when using lexer rule label references.

Inspired by beynyl. Since this patch uses std::unique_ptr the build now requires
a compiler supporting at least some C++11 features.