hxl
hxl copied to clipboard
impl Template sub language
Within quoted and heredoc string expressions, the sequences ${ and %{ begin template sequences. Templates let you > directly embed expressions into a string literal, to dynamically construct strings from other values.
Template = (
TemplateLiteral |
TemplateInterpolation |
TemplateDirective
)*
TemplateDirective = TemplateIf | TemplateFor;
TemplateInterpolation = ("${" | "${~") Expression ("}" | "~}";
TemplateIf = (
("%{" | "%{~") "if" Expression ("}" | "~}")
Template
(
("%{" | "%{~") "else" ("}" | "~}")
Template
)?
("%{" | "%{~") "endif" ("}" | "~}")
);
TemplateFor = (
("%{" | "%{~") "for" Identifier ("," Identifier) "in" Expression ("}" | "~}")
Template
("%{" | "%{~") "endfor" ("}" | "~}")
);