The solution generally consists of feeding information from the semantic symbol table back into the lexer.
Without added context, the lexer cannot distinguish type identifiers from other identifiers because all identifiers have the same format.