Nested Quasis

Waldemar Horwat waldemar at google.com
Mon Feb 6 15:26:02 PST 2012


On 02/03/2012 08:07 PM, Mark S. Miller wrote:
> On Fri, Feb 3, 2012 at 12:58 PM, Waldemar Horwat <waldemar at google.com <mailto:waldemar at google.com>> wrote:
>
>     On 02/02/2012 06:27 PM, Waldemar Horwat wrote:
>
> [...]
>
>     Note that this is more complex than just having the parser switch modes for the treatment of / as division vs. regexp.  Here comments and white space are also affected, which can in turn the structure of the lexer upside down.  The kinds of cases I'm thinking of are:
>
>     `abc$/*comment*/identifier//
>     `
>     (here we have a /**/ comment and a // comment)
>
>
> There is no valid quasiHole above, so the whole thing matches a QuasiOnly. The QuasiOnly includes all characters between the backticks. Nothing is taken to be a comment, just like it wouldn't be if it appeared within a string.

According to which lexical grammar?  According to the one you provided earlier in this thread, `abc$ is a QuasiOpen token:

   QuasiOpen ::
         ` QuasiChar* $


Parsing further, /*comment*/identifier is a single identifier token as far as the syntactic grammar is concerned.

     Waldemar


More information about the es-discuss mailing list