Add debugging output in key map creation

Requires the addition of a debug flag to `parse_mapping` and `parse_token`.

For some reason there is no declaration of the function `parse_token`. I'm
not sure why so I won't add it.