Re: completed action A-617-02 (add string templates to grammar)

On 15-09-25 05:33 PM, Michael Dyck wrote:
>> ACTION A-617-02: ETA 2015-09-29 Michael Dyck to write a grammar for
>> string templates with names and delimiters he chooses.
>
> Done, built the applets, committed stuff.

Specifically, here are the changed and new productions:

   [128] PrimaryExpr ::=
         ... | ArrayConstructor | StringConstructor | UnaryLookup

I decided on "StringConstructor" rather than "StringTemplate", because:
(a) The syntax already has the concept of "Constructor", and this new thing
seems to fit in well enough with that, so there didn't seem much benefit to
introducing the new term "Template".
(b) Makers of XQuery-based templating systems might appreciate not having to
make the distinction between their templates and StringTemplate.

(To emphasize the "Constructor" connection, I inserted StringConstructor
into the PrimaryExpr production after MapConstructor and ArrayConstructor,
rather than at the very end.)

   [177] StringConstructor ::= "@@[" StringConstructorContent "]@@"
   [178] StringConstructorContent ::= StringConstructorChars
             (StringConstructorInterpolation StringConstructorChars)*
   [179] StringConstructorChars ::=
             (Char* - (Char* ('@@{' | ']@@') Char*))  /* ws: explicit */
   [180] StringConstructorInterpolation ::= "@@{" Expr "}@@"

For the provisional delimiters, I picked the @@ ones, because they're
visible and I know they can't cause problems like ambiguity or change of
tokenization for existing queries.

I used the name 'StringConstructorInterpolation' rather than
'StringTemplateExpr' to address my point:
> Note that a StringTemplate actually *is* a kind of Expr,  whereas a
> StringTemplateExpr *isn't*. So I think these names could lead to confusion.

I realize that it's rather long (6 characters longer than the former
longest, 'CompNamespaceConstructor'). If that concerns people, I suppose we
could cut it down to 'StringInterpolation'.

-Michael

Received on Saturday, 26 September 2015 17:52:09 UTC