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)

52 Branch
defect
Not set
normal

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.
Component: Untriaged → JavaScript Engine
Product: Firefox → Core
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.
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.