Stefano Mazzocchi wrote:
how about
//@ encoding = UTF-8
instead? so that we can discriminate between comments and 'metadata comments'?
had a similar reflex, but from a different angle though: namely by considering how vim is doing this:
// vim: set fileencoding=iso-8859-1 nu ai:
so: I surely like the @ idea, but am doubthing if we shouldn't 'namespace' it some more (god knows how many more apps out there might be willing to do interesting annotations inside comments)
thinking of annotations, and the resemblance of js to java: we could require /** comments?
(which is not single line however, so stretches the first-line requirement)
here people would suggest to embed RDF in it ;-)
KISS!
Ok, so here's the regexp:
^.*encoding\s*=\s*([^\s]+)
This matches "encoding = xxx" on the first line with any space combination around "=" and with anything you like before "encoding", be it "//" "// @" or "// vim: set file".
Sylvain
-- Sylvain Wallez Anyware Technologies http://www.apache.org/~sylvain http://www.anyware-tech.com { XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }