Use subset directive grammar

Allen Wirfs-Brock Allen.Wirfs-Brock at microsoft.com
Mon Sep 21 19:55:23 PDT 2009


Nice catch...it looks like I need to mention the semicolon (which may be supplied by automatic semicolon insertion).

The parentheses form is not intended to be a directive.

allen

>-----Original Message-----
>From: es-discuss-bounces at mozilla.org [mailto:es-discuss-
>bounces at mozilla.org] On Behalf Of Mike Samuel
>Sent: Monday, September 21, 2009 6:33 PM
>To: es-discuss at mozilla.org
>Subject: Use subset directive grammar
>
>From section 14.1 of
>http://wiki.ecmascript.org/lib/exe/fetch.php?id=es3.1%3Aes3.1_proposal_w
>orking_draft&cache=cache&media=es3.1:es5-tc392008-040.pdf
>
>    A Directive Prologue is a sequence of zero or more
>ExpressionStatement productions,
>    each of which having an Expression consists entirely of a
>StringLiteral, that occur as the initial
>    SourceElement productions of a Program or FunctionBody.
>
>What does "consists entirely" mean?
>
>From the grammar in the appendix, to get from ExpressionStatement to
>StringLiteral, I have to go through the following grammar chain:
>    ExpressionStatement -> AssignmentExpression ->
>ConditionalExpression -> (lots of operator precedence elided)
>    -> LeftHandSideExpression -> NewExpression -> MemberExpression ->
>PrimaryExpression -> Literal -> StringLiteral
>
>One way to define "consists entirely" might be: an A that consists
>entirely of B if it matches A and B and all tokens were consumed by
>matching B.
>That definition is consistent with
>  "use strict"
>but not
>  "use strict";
>since the ";" is actually part of the ExpressionStatement production.
>
>Is there a definition of "consists entirely" that matches
>  "use strict";
>and
>  "use strict"
>but not
>  ("use strict");
>?
>
>Or can the last be part of a directive prologue?
>_______________________________________________
>es-discuss mailing list
>es-discuss at mozilla.org
>https://mail.mozilla.org/listinfo/es-discuss



More information about the es-discuss mailing list