Quasi-literals for templating?

Axel Rauschmayer axel at rauschma.de
Wed Jun 15 17:51:32 PDT 2011


Sorry, I just meant the acronym: what does it stand for?

On Jun 16, 2011, at 2:49 , Mike Samuel wrote:

> 2011/6/15 Axel Rauschmayer <axel at rauschma.de>:
>> Quick feedback: I haven’t seen SVE (substitution value expression?) defined anywhere and can’t find a description of using ${{var}} as syntactic sugar for "{var:${var}}".
> 
> SVE is defined in
> http://wiki.ecmascript.org/doku.php?id=harmony:quasis#substitution_body_syntax
> reproduced below:
> 
> SVE
> 
> Production	 Result
> QuasiLiteral :: QuasiTag`LiteralPortion QuasiLiteralTail	 SVE(QuasiLiteralTail)
> QuasiLiteralTail :: Substitution LiteralPortion QuasiLiteralTail	
> array-concat(single-element-array(SVE(Substitution)),
> SVE(QuasiLiteralTail))
> QuasiLiteralTail :: `	 an empty array
> Substitution :: $Identifier	PrimaryExpression : Identifier
> Substitution :: ${SubstitutionModifier Identifier}	PrimaryExpression
> SubstitutionBody :: Identifier IdentifierPathTail	MemberExpression :
> str-concat(SV(Identifier), SV(IdentifierPathTail))
> IdentifierPathTail :: .IdentifierName IdentifierPathTail	
> str-concat(“.”, SV(IdentifierName), SV(IdentifierPathTail))
> IdentifierPathTail :: ε	 the empty string, ““
> 
> The SVE of a substitution is an expression that is evaluated in the
> scope in which the quasiliteral appears. The SVE of the quasi literal
> is the array of the SVE for each substitution.
> 
> E.g. the SVE of quasitag`literalPortion0 $x literalPortion1 $y.z
> literalPortion2` is [x, y.z].
> 

-- 
Dr. Axel Rauschmayer

axel at rauschma.de
twitter.com/rauschma

home: rauschma.de
blog: 2ality.com





More information about the es-discuss mailing list