-
-
Notifications
You must be signed in to change notification settings - Fork 36
Update the rest of the spec to match the ABNF after adding .keywords
#548
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
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,46 @@ | ||
<!ELEMENT message (declaration*,(pattern|(selectors,variant+)))> | ||
<!ELEMENT message ( | ||
(declaration | unsupportedStatement)*, | ||
(pattern | (selectors,variant+)) | ||
)> | ||
|
||
<!-- In a <declaration type="input">, the <expression> MUST contain a <variable> --> | ||
<!ELEMENT declaration (expression)> | ||
<!ATTLIST declaration name NMTOKEN #REQUIRED> | ||
<!ATTLIST declaration | ||
type (input | local) #REQUIRED | ||
name NMTOKEN #REQUIRED | ||
> | ||
|
||
<!ELEMENT unsupportedStatement (expression)+> | ||
<!ATTLIST unsupportedStatement | ||
keyword CDATA #REQUIRED | ||
body CDATA #IMPLIED | ||
> | ||
|
||
<!ELEMENT selectors (expression)+> | ||
<!ELEMENT variant (key+,pattern)> | ||
<!ELEMENT key (#PCDATA)> | ||
<!ATTLIST key default (true | false) "false"> | ||
|
||
<!ELEMENT pattern (#PCDATA | expression)*> | ||
<!ELEMENT expression (literal | variable | function | unsupported)> | ||
|
||
<!ELEMENT expression ( | ||
((literal | variable), (function | unsupportedExpression)?) | | ||
function | unsupportedExpression | ||
)> | ||
|
||
<!ELEMENT literal (#PCDATA)> | ||
<!ATTLIST literal quoted (true | false) #REQUIRED> | ||
|
||
<!ELEMENT variable (EMPTY)> | ||
<!ATTLIST variable name NMTOKEN #REQUIRED> | ||
|
||
<!ELEMENT function (operand?,option*)> | ||
<!ELEMENT function (option)*> | ||
<!ATTLIST function | ||
kind (open | close | value) #REQUIRED | ||
name NMTOKEN #REQUIRED | ||
> | ||
<!ELEMENT operand (literal | variable)> | ||
<!ELEMENT option (literal | variable)> | ||
<!ATTLIST option name NMTOKEN #REQUIRED> | ||
|
||
<!ELEMENT unsupported (operand?,source)> | ||
<!ATTLIST unsupported sigil CDATA #REQUIRED> | ||
<!ELEMENT source (#PCDATA)> | ||
<!ELEMENT unsupportedExpression (#PCDATA)> | ||
<!ATTLIST unsupportedExpression sigil CDATA #REQUIRED> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency with the data model implied by the grammar,
func
fields should probably be renamed (and possiblyFunctionExpression
as well, in both the grammar and here).etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One challenge with "annotation" is that when it's in an expression without an operand, what is it "annotating"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The expression.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To me this sounds rather tautological. I'd be happy for us to discuss this naming briefly during tomorrow's call, and to go with whatever the majority prefers (as in, spend max 5 min and either reach a conclusion or continue from there async).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you glance at the agenda you'll notice that I have a bunch of these short highly timeboxed issues for tomorrow. I've added this one.
I'll note that the current ABNF uses the term
function-expression
and the data model should basically match the ABNF word-for-word to the extent possible. KeepingFunctionExpression
seems fine?I do think that this might not be right, though:
UnsupportedAnnotation
applies toreserved-annotation
but not necessarily toprivate-use-annotation
. Private use is only supported if the implementation says it is. So we need a third bucket for private use to go into so that implementations that support the PU can consume it, e.g.:(it is possible for a private-use to be unsupported)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the cases where the implementation does support a specific private-use annotation, we have this:
message-format-wg/spec/data-model/README.md
Lines 167 to 171 in f359856
And then in the Extensions section, we specify that an implementation is allowed to extend the data model for that purpose. Or at least it's intended to do so.
So we can at this point lump all of the unsupported reserved & private-use into this one basket of the data model, rather than needing to split it as in the syntax.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the data-model is meant to be interchanged, does that mean that the "private-use-ness" might be a relevant detail to the consumer? I mean, maybe it's
FunctionRef
but if it weren't, it wouldn't beUnsupportedAnnotation
necessarily either? Or am I barking up the wrong tree? 🌳There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If an implementation does define and support a private-use annotation, I think there are two options for its data model representation:
func
value or maybe as an operand of some sort. But then why need the new syntax in the first place?Expression
interfaces.If going the first route, then interchange is of course easier, but that syntax will also have some representation without private use. If going the second route, interchange will require both ends to agree about the private-use.