resource-reasoning / jscert_dev

This repository is now abandoned in favour of using
https://github.com/jscert/jscert
Other
0 stars 0 forks source link

Parser Interface?: "use strict" with lexing 'irregularities' mishandled #35

Open IgnoredAmbience opened 9 years ago

IgnoredAmbience commented 9 years ago

tests/test262/ch14/14.1/14.1-4-s.js tests for

'use str\
ict';

Esprima outputs:

                                {
                                    "type": "ExpressionStatement",
                                    "expression": {
                                        "type": "Literal",
                                        "value": "use strict",
                                        "raw": "'use str\\\r\nict'",
                                        "range": [
                                            579,
                                            594
                                        ]
                                    }

I think we're using the value instead of raw_value?

IgnoredAmbience commented 9 years ago

Also tests/test262/ch14/14.1/14.1-5-s.js

Mbodin commented 9 years ago

Hi,

From the standard: A Use Strict Directive is an ExpressionStatement in a Directive Prologue whose StringLiteral is either the exact character sequences "use strict" or 'use strict'. A Use Strict Directive may not contain an EscapeSequence or LineContinuation.

I have to admit that I’m quite impressed by this part of the standard: I really thought that escaping a string would result into the exact same behaviour. It seems EcmaScript thinks otherwise… :-\ However, I don’t know this part of the interpreter, sorry.

Martin.

tests/test262/ch14/14.1/14.1-4-s.js tests for

'use str\ ict';

Esprima outputs:

                             {
                                 "type":"ExpressionStatement",
                                 "expression": {
                                     "type":"Literal",
                                     "value":"use strict",
                                     "raw":"'use str\\\r\nict'",
                                     "range": [
                                         579,
                                         594
                                     ]
                                 }

I think we're using the value instead of raw_value?

IgnoredAmbience commented 9 years ago

Ok, this code is in the parser module.