From ae993283a1211234fea6ae8362c1307da59f3a71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stanis=C5=82aw=20Ma=C5=82olepszy?= Date: Sun, 18 Jun 2023 23:41:21 +0200 Subject: [PATCH] Change the syntax of the ::open and :/close function calls This is a follow-up to #364, which made it possible to use unquoted literals in the argument position in placeholders. However, due to the current syntax of +open and -close function calls, arguments that are number literals must still be quoted, e.g. `{|-1| :number}`. This PR proposes to change the syntax of markup-like function calls: BEFORE: {+button title=|Click me!|}Submit{-button} AFTER: {::button title=|Click me!|}Submit{:/button} The benefit of using a two-char-long prefix is that we effectively establish the colon `:` as the general-purpose function introducer. --- spec/formatting.md | 8 ++++---- spec/message.abnf | 2 +- spec/syntax.md | 16 ++++++++-------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/spec/formatting.md b/spec/formatting.md index 67b309a237..382c85185b 100644 --- a/spec/formatting.md +++ b/spec/formatting.md @@ -483,14 +483,14 @@ Between the brackets, the following contents are used: > Example: `{:platform}` - Opening _expression_ with no operand: - U+002B PLUS SIGN `+` followed by the _function_ _name_ + U+003A COLON `:` followed by U+003A COLON `:` and then by the _function_ _name_ - > Example: `{+tag}` + > Example: `{::tag}` - Closing _expression_ with no operand: - U+002D HYPHEN-MINUS `-` followed by the _function_ _name_ + U+003A COLON `:` followed by U+002F SOLIDUS `/` and then by the _function_ _name_ - > Example: `{-tag}` + > Example: `{:/tag}` - Otherwise: The U+FFFD REPLACEMENT CHARACTER `�` character diff --git a/spec/message.abnf b/spec/message.abnf index 30f0da2fd5..b0bf792616 100644 --- a/spec/message.abnf +++ b/spec/message.abnf @@ -14,7 +14,7 @@ annotation = (function *(s option)) / reserved literal = quoted / unquoted variable = "$" name -function = (":" / "+" / "-") name +function = ":" [":" / "/"] name option = name [s] "=" [s] (literal / variable) ; reserved keywords are always lowercase diff --git a/spec/syntax.md b/spec/syntax.md index 8637a78682..d100a7b761 100644 --- a/spec/syntax.md +++ b/spec/syntax.md @@ -146,13 +146,13 @@ plucking the first name from the object representing a person: Functions use one of the following prefix sigils: - `:` for standalone content -- `+` for starting or opening elements -- `-` for ending or closing elements +- `::` for starting or opening elements +- `:/ for ending or closing elements A message with two markup-like _functions_, `button` and `link`, which the runtime can use to construct a document tree structure for a UI framework: - {{+button}Submit{-button} or {+link}cancel{-link}.} + {{::button}Submit{:/button} or {::link}cancel{:/link}.} An opening element MAY be present in a message without a corresponding closing element, and vice versa. @@ -395,17 +395,17 @@ option = name [s] "=" [s] (literal / variable) > ``` > > ``` -> {+ssml.emphasis level=strong} +> {::ssml.emphasis level=strong} > ``` > > Message examples: > > ``` -> {This is {+b}bold{-b}.} +> {This is {::b}bold{:/b}.} > ``` > > ``` -> {{+h1 name=above-and-beyond}Above And Beyond{-h1}} +> {{::h1 name=above-and-beyond}Above And Beyond{:/h1}} > ``` #### Reserved @@ -483,7 +483,7 @@ unquoted-start = name-start / DIGIT / "." ### Names The **_name_** token is used for variable names (prefixed with `$`), -function names (prefixed with `:`, `+` or `-`), +function names (prefixed with `:`, `::` or `:/`), as well as option names. It is based on XML's [Name](https://www.w3.org/TR/xml/#NT-Name), with the restriction that it MUST NOT start with `:`, @@ -492,7 +492,7 @@ Otherwise, the set of characters allowed in names is large. ```abnf variable = "$" name -function = (":" / "+" / "-") name +function = ":" [":" / "/"] name name = name-start *name-char name-start = ALPHA / "_"