Cleanup heredoc parsing by removing some duplicated lex code