Newlines in blockcomments
liorean at gmail.com
Fri Sep 21 18:26:03 PDT 2007
According to ES3, a blockcomment which contains at least one newline
parses like a LineTerminator, and isn't just thrown away. That means
/**/ and /*\n*/ will behave different with regards to all the
constructs that have [no LineTerminator here] limitations.
I doubt this is expected behaviour for developers - developers don't
expect the contents of comments to change the meaning of the code
JScript seem to obey this part of the ES3 spec. Opera's engines are to
my knowledge the only browser hosted ones that do.
Wouldn't it be better to simply treat all blockcomments alike?
(Opera bug 280849, Mozilla bug 397104)
This code returns undefined in linear_b and in futhark, per ES3. This
which I think is the behaviour that the vast majority of developers
I haven't done any extensive studies of this in the other places where
[no LineTerminator here] can be found in the syntactic grammar.
However, I note that the behaviour is not consistent between
PostFixExpression and ReturnStatement in a few engines.
a /**/ ++;
SpiderMonkey and Futhark: SyntaxError
David "liorean" Andersson
More information about the Es4-discuss