updated version which handles ignoring comments, heredocs, regexdocs etc.