On Wednesday 16 September 2009 04:14:59 Crístian Viana wrote: > but in that case the "#" character is inside a string, so it wuldn't be > considered a comment. I was thinking like "//" in Java: it can be anywhere > in the line, but if it's inside a string it's not considered a comment > marker. > > but thanks again for the information :)
To deal with a hash anywhere, you need a complex language parser and probably a full blown tokenizer like compilers have to implement. This is decidedly non-trivial. Java is a freeform language, the location of line breaks does not really matter. Config files are very different beasts, they are very much line oriented - one setting per line. Think like grep, it deals with a line at a time. So the easiest implementation by far is the comment marker must be the first non-whitespace character, other wise it isn't a comment. That one step can make most of your config file bugs never happen, just like that. -- alan dot mckinnon at gmail dot com

