This defines the substitution body of a quasi using the PrimaryExpression syntactic production. Determining where a substitution ends requires, in the general case, the ability to parse an EcmaScript expression. See a lexer demo that demonstrates how to lex JavaScript when quasiliterals can nest.

SubstitutionBody ::

  • PrimaryExpression

SubstitutionModifier ::

  • ε


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 :: $IdentifierPrimaryExpression : Identifier
Substitution :: ${SubstitutionModifier SubstitutionBody} SVE(SubstitutionBody)
SubstitutionBody :: PrimaryExpressionPrimaryExpression

The SVE is an expression that evaluates the specified expression in the scope in which the quasi appears. The SVE of the quasi literal is the array of the SVE for each substitution body.

strawman/quasis-substitutions-primaryexpr.txt · Last modified: 2011/06/04 16:54 by mikesamuel
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki