Directive prologue members, escapes, and retroactive syntax errors

Oliver Hunt oliver at
Wed Oct 13 14:40:08 PDT 2010

On Oct 13, 2010, at 12:09 PM, Jeff Walden wrote:

> The MS ES5 test suite has a test which boils down to this:
> function error()
> {
>  "\145"; // ohai, octal escape
>  "use strict"; // causes a RETROACTIVE SYNTAX ERROR
> }
> Thoughts from other parser hackers out there?

I thought it was a pretty evil test as well.  In terms of complexity it wasn't too difficult in JSC -- as the directives have essentially no side effects we just run through the directives until we reach one we recognise (eg. "use strict").  At that point we push ourselves into strict mode, rollback the lexer, and start again.  Given you're unlikely to have a huge number of directives this has no real perf cost.


> Jeff
> _______________________________________________
> es5-discuss mailing list
> es5-discuss at

More information about the es5-discuss mailing list