Nested Quasis

Allen Wirfs-Brock allen at wirfs-brock.com
Wed Feb 1 18:20:05 PST 2012


On Feb 1, 2012, at 5:33 PM, Waldemar Horwat wrote:

> On 02/01/2012 11:35 AM, Allen Wirfs-Brock wrote:
>> 
>> On Feb 1, 2012, at 11:28 AM, Waldemar Horwat wrote:
>> 
>>> On 01/31/2012 03:04 PM, Allen Wirfs-Brock wrote:
>>>> 
>>>> On Jan 31, 2012, at 2:36 PM, Waldemar Horwat wrote:
>>>> 
>>>>> On 01/28/2012 02:54 PM, Erik Arvidsson wrote:
>>>>>> Under the open issues for Quasi Literals,
>>>>>> http://wiki.ecmascript.org/doku.php?id=harmony:quasis#nesting , the
>>>>>> topic of nesting is brought up.
>>>>>> 
>>>>>> After implementing Quasi Literals in Traceur it is clear that
>>>>>> supporting nested quasi literals is easier than not supporting them.
>>>>>> What is the argument for not supporting nesting? Can we resolve this?
>>>>> 
>>>>> This has been hashed out in committee before.  Do you have a solution to the grammar problems, such as having a full ECMAScript parser inside the lexer?  You can't just count parentheses because that breaks regexps.
>>>> 
>>>> I would think the solution to this is pretty straightforward.  Basically, a Quasi is not a single token.   the grammar in the proposal can almost be read that way right now.   It should only take a little cleanup to factor it into a pure lexical part and a syntactic part.
>>> 
>>> I'd love to see this little cleanup.  I thought about it for a while and couldn't come up with it myself; I'm not sure it can even be done.
>> 
>> Was there some particular issue you were running into?
> 
> Here's one which I couldn't express in a lexer grammar: How to restart the quasi after an included expression is over.

I wouldn't because I would produce the complete quasi as a single token.  I would leave it up to the syntactic grammar to assemble the quasi pieces and inclusion expression into a complete unit.

Allen


More information about the es-discuss mailing list