https://en.wikipedia.org/wiki/Lexer_hack
Make your parser call back into your lexer, so it can pass state to it; make the set of type names available to it.