Refactored the ParserTypes.emit function into several smaller functions which'll be easier to work on.