On 11/27/2013 12:07 AM, Waldemar Horwat wrote:
On 11/26/2013 03:00 PM, André Bargull wrote:
On 11/26/2013 02:28 PM, Claude Pache wrote:
>/ From the thread [1], I guess that parsing correctly the
following thing would be obnoxious (at best)?
/>/
/>/ (a = yield/b/g) =>* {}
/>/
/>/ —Claude
/
Indeed.
And you can make even more obnoxious parses of the hypothetical
combination of =>*, default parameters, and retroactive yield-scope:
(a = yield/"/) =>* (/"/g)
Are the two /"/'s regexps or is "/) =>* (/" a string token?
Waldemar
Are you sure? The `(a = yield/b/g)` part is parsed at first as a
parenthesised expression and only later (after the `=>` token)
reinterpreted as an ArrowFormalParameters grammar production.
- André
Fine, so do this one instead:
(a = yield/"/g, b = yield/"/g) =>* {}
Does this generator have one or two parameters?
It depends on the surrounding environment.
Lexical token sequence in function environment:
LP
Ident[a] Assign Ident[yield] Div String Div Ident[g]
RP
Lexical token sequence in generator environment:
LP
Ident[a] Assign Yield RegExp
Comma
Ident[b] Assign Yield RegExp
RP
Reinterpreting the lexical token sequence per [14.2]:
It is a Syntax Error if the lexical token sequence matched by
CoverParenthesisedExpressionAndArrowParameterList cannot be parsed with no
tokens left over using
ArrowFormalParameters as the goal symbol.
And applying the current (rev21) grammar production rule
`FormalParameters[Yield,GeneratorParameter]` [14.4], gives either a
generator with a single parameter (if in function environment) or a
SyntaxError (if in generator environment). The SyntaxError is emitted
because `FormalParameters[Yield,GeneratorParameter]` does not allow
YieldExpressions [13.2.3], instead "yield" is treated as an
IdentifierReference in function default parameters.
If the term "parsing a lexical token sequence" allows you to go back to
the source character level, the result will be different, of course.
Waldemar
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss