Skip to content

Clarify that Reserved may also represent private-use in data model #444

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 20 additions & 10 deletions spec/data-model/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ The `value` of `Text` is the "cooked" value (i.e. escape sequences are processed

Implementations MUST NOT rely on the set of `Expression` `body` values being exhaustive,
as future versions of this specification MAY define additional expressions.
If encountering a `body` with an unrecognised value,
an implementation SHOULD treat it as it would a `Reserved` value.
A `body` with an unrecognized value SHOULD be treated as an `Unsupported` value.

```ts
interface Pattern {
Expand All @@ -95,7 +94,7 @@ interface Text {

interface Expression {
type: 'expression'
body: Literal | VariableRef | FunctionRef | Reserved
body: Literal | VariableRef | FunctionRef | Unsupported
}
```

Expand Down Expand Up @@ -148,20 +147,31 @@ interface Option {
}
```

A `Reserved` represents an _expression_ with a _reserved_ _annotation_.
The `sigil` corresponds to the starting sigil of the _reserved_.
An `Unsupported` represents an _expression_ with a
_reserved_ _annotation_ or a _private-use_ _annotation_ not supported
by the implementation.
The `sigil` corresponds to the starting sigil of the _annotation_.
The `source` is the "raw" value (i.e. escape sequences are not processed)
and includes the starting `sigil`.
and does not include the starting `sigil`.

Implementations MUST NOT rely on the set of `sigil` values remaining constant,
as future versions of this specification MAY assign other meanings to such sigils.
> **Note**
> Be aware that future versions of this specification
> might assign meaning to _reserved_ `sigil` values.
> This would result in new interfaces being added to
> this data model.

If the _expression_ includes a _literal_ or _variable_ before the _annotation_,
it is included as the `operand`.

When parsing the syntax of a _message_ that includes a _private-use_ _annotation_
supported by the implementation,
the implementation SHOULD represent it in the data model
using an interface appropriate for the semantics and meaning
that the implementation attaches to that _annotation_.

```ts
interface Reserved {
type: 'reserved'
interface Unsupported {
type: 'unsupported'
sigil: '!' | '@' | '#' | '%' | '^' | '&' | '*' | '<' | '>' | '/' | '?' | '~'
source: string
operand?: Literal | VariableRef
Expand Down
6 changes: 3 additions & 3 deletions spec/data-model/message.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<!ATTLIST key default (true | false) "false">

<!ELEMENT pattern (#PCDATA | expression)*>
<!ELEMENT expression (literal | variable | function | reserved)>
<!ELEMENT expression (literal | variable | function | unsupported)>

<!ELEMENT literal (#PCDATA)>
<!ATTLIST literal quoted (true | false) #REQUIRED>
Expand All @@ -26,6 +26,6 @@
<!ELEMENT option (literal | variable)>
<!ATTLIST option name NMTOKEN #REQUIRED>

<!ELEMENT reserved (operand?,source)>
<!ATTLIST reserved sigil CDATA #REQUIRED>
<!ELEMENT unsupported (operand?,source)>
<!ATTLIST unsupported sigil CDATA #REQUIRED>
<!ELEMENT source (#PCDATA)>
6 changes: 3 additions & 3 deletions spec/data-model/message.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@
},
"required": ["type", "kind", "name"]
},
"reserved": {
"unsupported": {
"type": "object",
"properties": {
"type": { "const": "reserved" },
"type": { "const": "unsupported" },
"sigil": {
"enum": ["!", "@", "#", "%", "^", "&", "*", "<", ">", "?", "~"]
},
Expand All @@ -77,7 +77,7 @@
{ "$ref": "#/$defs/literal" },
{ "$ref": "#/$defs/variable" },
{ "$ref": "#/$defs/function" },
{ "$ref": "#/$defs/reserved" }
{ "$ref": "#/$defs/unsupported" }
]
}
},
Expand Down