quasi-literal strawman

Mike Samuel mikesamuel at gmail.com
Wed Dec 16 14:23:38 PST 2009


2009/12/16 Mark S. Miller <erights at google.com>:
> On Wed, Dec 16, 2009 at 12:43 PM, Ash Berlin <ash_js at firemirror.com> wrote:
>>
>> On 16 Dec 2009, at 20:21, Mike Samuel wrote:
>>
>> > jsont`{$name:html}: <a
>> > href="{$url|html-attr-value}">{$anchor|html}</a>{default=html}`
>> >
>> > function jsont(var_args) {
>> >  var literalPortions = Array.prototype.slice.call(arguments, 0);
>>
>>
>> So if i remember correctly:
>>
>> foo`a${b}c` -> foo("a", "c')(b);
>>
>> How then are these treated:
>>
>> foo`a${b}${d}c`
>
> foo("a","","c")(b,d)
>
>>
>> foo`a${b}c${d}`
>
> foo("a","c","")(b,d)

Exactly.  The operative parts of the syntax being:

    QuasiLiteral ::
        QuasiTypeTag [no LineTerminator here] ` LiteralPortion
QuasiLiteralTail `
    QuasiLiteralTail ::
        Substitution LiteralPortion QuasiLiteralTail
        ε

which guarantees that there will always be exactly one more
LiteralPortion than Substitution, and

    LiteralPortion ::
        LiteralCharacter LiteralPortion
        ε

which allows a LiteralPortion to be empty.  And the semantics clause

    The LPA of LiteralPortion :: ε is the empty string.



>>
>> -ash
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>
>
>
> --
>    Cheers,
>    --MarkM
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>


More information about the es-discuss mailing list