Closed
Bug 351371
Opened 18 years ago
Closed 18 years ago
e4x parsing fails with processing instructions in prolog or epilog
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 336551
People
(Reporter: sayrer, Unassigned)
Details
Rhino 1.6r3 does a bit better than Spidermonkey 5 test cases: 1.) var x = function(){ var x = <?foo bar?><y>asdf</y>; } 2.) var x = function(){ var x = <?foo bar?><y>asdf</y><?foo bar?>; } 3.) var x = function(){ var x = <?foo bar?><y><?foo bar?>asdf</y>; } 4.) var x = function(){ var x = <?foo bar?><y><?foo bar?>asdf</y><?foo bar?>; } 5.) var x = function(){ var x = <y><?foo bar?>asdf</y>; } Spidermonkey trunk ---------------------------------- js> var x = function(){ var x = <?foo bar?><y>asdf</y>; } typein:1: SyntaxError: unterminated regular expression literal: typein:1: var x = function(){ var x = <?foo bar?><y>asdf</y>; } typein:1: ...............................................^ js> var x = function(){ var x = <?foo bar?><y>asdf</y><?foo bar?>; } typein:2: SyntaxError: unterminated regular expression literal: typein:2: var x = function(){ var x = <?foo bar?><y>asdf</y><?foo bar?>; } typein:2: ...............................................^ js> var x = function(){ var x = <?foo bar?><y><?foo bar?>asdf</y>; } typein:3: SyntaxError: missing ; before statement: typein:3: var x = function(){ var x = <?foo bar?><y><?foo bar?>asdf</y>; } typein:3: .....................................................^ js> var x = function(){ var x = <?foo bar?><y><?foo bar?>asdf</y><?foo bar?>; } typein:4: SyntaxError: missing ; before statement: typein:4: var x = function(){ var x = <?foo bar?><y><?foo bar?>asdf</y><?foo bar?>; } typein:4: .....................................................^ js> var x = function(){ var x = <y><?foo bar?>asdf</y>; } js> x function () { var x = <y><?foo bar?>asdf</y>; } js> Rhino 1.6r3 ---------------------------- js> var x = function(){ var x = <?foo bar?><y>asdf</y>; } js> x function () { var x = <?foo bar?><y>asdf</y>; } js> var x = function(){ var x = <?foo bar?><y>asdf</y><?foo bar?>; } js: "<stdin>", line 6: syntax error js: var x = function(){ var x = <?foo bar?><y>asdf</y><?foo bar?>; } js: ...................................................^ js: "<stdin>", line 6: Compilation produced 1 syntax errors. js> var x = function(){ var x = <?foo bar?><y><?foo bar?>asdf</y>; } js> x function () { var x = <?foo bar?><y><?foo bar?>asdf</y>; } js> var x = function(){ var x = <?foo bar?><y><?foo bar?>asdf</y><?foo bar?>; } js: "<stdin>", line 9: syntax error js: var x = function(){ var x = <?foo bar?><y><?foo bar?>asdf</y><?foo bar?>; } js: ..............................................................^ js: "<stdin>", line 9: Compilation produced 1 syntax errors. js> var x = function(){ var x = <y><?foo bar?>asdf</y>; } js> x function () { var x = <y><?foo bar?>asdf</y>; }
Comment 1•18 years ago
|
||
ECMA-357 says what? I'm still hysterically blind from reading it closely the last time I worked on implementing it and fed errata back into ECMA/ISO. /be
Comment 2•18 years ago
|
||
Spidermonkey's right here, and Rhino is not. From the prose description in 11.1.4, "[An XML initializer] may specify an XML element, an XML comment, an XML PI, or a CDATA section using ordinary XML syntax." From the more normative grammar: XMLInitialiser : XMLMarkup XMLElement XMLMarkup :: XMLComment XMLCDATA XMLPI <?foo bar?><el></el> might be a valid document, but documents aren't allowed as XML initializers. This is even the right behavior, I believe, because otherwise the parser must perform some sort of fragile lookahead to determine when a literal ends. (Elsewhere in the spec, XMLList is identified as the preferred container for documents, and it wouldn't suffer the same lookahead problem.) We could do better with the error messages here, tho -- ideally all the testcases would fail immediately after parsing the leading processing instruction with some informative error.
Reporter | ||
Comment 3•18 years ago
|
||
(In reply to comment #2) > Spidermonkey's right here, and Rhino is not. Ta. But, js> XML.ignoreProcessingInstructions true js> XML.ignoreProcessingInstructions = false false js> XML.ignoreProcessingInstructions false js> var x = new XML("<?foo bar?><el></el>"); typein:11: SyntaxError: syntax error js> var x = new XML("<?foo bar?><el></el><?foo bar?>"); typein:12: SyntaxError: syntax error js> var x = new XML("<el><?foo bar?></el>"); js> x.toXMLString(); <el> <?foo bar?> </el> js> XML.ignoreProcessingInstructions = true; true js> var x = new XML("<?foo bar?><el></el><?foo bar?>"); js> x.toXMLString(); <el/> js>
Reporter | ||
Comment 4•18 years ago
|
||
Filed bug 351988 on this decompilation: js> var x = function() { var y = <?foo bar?>; } function () { var y = <?foo "bar"?>; }
Reporter | ||
Comment 5•18 years ago
|
||
looks like this is a dupe of bug 336551. I file a new bug on Rhino so it's not confusing for them. *** This bug has been marked as a duplicate of 336551 ***
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → DUPLICATE
Comment 6•18 years ago
|
||
(In reply to comment #2) > We could do better with the error messages here, tho -- ideally all the > testcases would fail immediately after parsing the leading processing > instruction with some informative error. File a bug? /be
You need to log in
before you can comment on or make changes to this bug.
Description
•