Fix memory leak when using lexer rule label references.

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