I needed to clean someone else code and run it through tidy.source. It encountered a number of hangups which after some experimentation lead me to suspect that the culprit is # symbol when it is a part of literal string. For example if i copy the following to the clipboard

confuse.tidy <- 
  function()
{
  txt <- 'abra # cadabra'
}

and run with default arguments

>tidy.source()

I am getting
Error in base::parse(text = text, srcfile = NULL) : 
  4:46: unexpected INCOMPLETE_STRING
4: txt <- 'abra  %InLiNe_IdEnTiFiEr% "# cadabra'"
5: }

However, good news, as i realized after a bit of struggle, is that i could do 

>tidy.source(keep.comment=F)

which produces desired 

confuse.tidy <- function() {
    txt <- "abra # cadabra"
}


Unfortunately, # is sometimes a legitimate part of strings, for example when you grep through lines from a web page, or when you specify a color in a string with #. So, I thought it'd be useful to point this out so that someone think of a workaround for this as dropping comments  sometimes means dropping something valuable.  
	[[alternative HTML version deleted]]

