Skip to content
This repository has been archived by the owner on Jul 31, 2018. It is now read-only.

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

Open
IgnoredAmbience opened this issue Jul 20, 2015 · 3 comments

Comments

@IgnoredAmbience
Copy link
Member

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 IgnoredAmbience changed the title Parser Interface?: "use strict" with line continuation mishandled Parser Interface?: "use strict" with lexing 'irregularities' mishandled Jul 20, 2015
@IgnoredAmbience
Copy link
Member Author

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

@Mbodin
Copy link
Contributor

Mbodin commented Jul 20, 2015

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
Copy link
Member Author

Ok, this code is in the parser module.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants