Closed
Bug 1358329
Opened 8 years ago
Closed 8 years ago
js does not obey EOL line continuation character '_', see EBNF
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: jmichae3, Unassigned)
Details
User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:52.0) Gecko/20100101 Firefox/52.0
Build ID: 20170323105023
Steps to reproduce:
http://jesusnjim.com/bugs/js-not-obey-_.html
you can put either script first and it will give an error. one uses \ for a line continuation character and one uses _ for a line continuation character (which _ is in the EBNF, but it's a lone item like on an island in the EBNF and hard to find)
this means that contrary to js compressors, you cannot use a solitary _ on the end of a line for a variable identifier or as just an identifier.
Actual results:
SyntaxError: missing ) after condition js-not-obey-_.html:13:1
SyntaxError: illegal character js-not-obey-_.html:26:10
browser is not obeying spec concerning end-of-line handling of EOL continuation character _ which is from a (should be a bug) problem in javascript where statements must nearly be on 1 line to work.
Expected results:
_ at end of line should continue the line in javascript to the next line. that includes // comments I should assume. or does it? what says the w3 or whatwg? maybe // line comments should be the exception. that would make the parser more complicated.
Comment 1•8 years ago
|
||
Which EBNF? Line continuations (https://tc39.github.io/ecma262/#prod-LineContinuation) must start with \ and are only valid in string (https://tc39.github.io/ecma262/#prod-DoubleStringCharacter, https://tc39.github.io/ecma262/#prod-SingleStringCharacter) and template (https://tc39.github.io/ecma262/#prod-TemplateCharacter) literals.
| Reporter | ||
Comment 2•8 years ago
|
||
I thought js was moved back to ansi by now. it did start with Netscape after all, didn't it?
that ENBF is not done well enough. it ignores the presence of whitespace characters like CR and LF in the sequence.
and this escape sequence. to be more accurate, a line continuation sequence is:
lineContinuation::=
||'\' followed by CR followed by LF.
||'\' followed by LF
;
or it will not recognize EOL to continue on. also, it is good to note that a double and single string escape are continued by this lineContinuation.
ff does not follow any of the above. try it.
Comment 3•8 years ago
|
||
you're confusing the ECMAScript spec and something else (please clarify the grammar spec if you think it's really related).
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•