Optimisation for parser - getting rid of the massive succession of "if" statements and replacing with a hashmap.