-
-
Notifications
You must be signed in to change notification settings - Fork 36
Implement private-use
separately from reserved
#421
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
13 commits
Select commit
Hold shift + click to select a range
18523e5
Separate private-use from reserved
aphillips f11dbbc
Implement private-use in the ABNF
aphillips e0f70e9
"missed a spot"
aphillips 46fbf4b
Update spec/syntax.md
aphillips a788820
Update spec/syntax.md
aphillips 816866e
Update spec/syntax.md
aphillips 70d9c27
Update spec/syntax.md
aphillips bbf4b86
Update message.abnf
aphillips 2bb8d15
Address private-use and reserved escaping
aphillips 5228e97
Update syntax.md
aphillips 77ef04e
Address changes to private use in formatting.md
aphillips 598d95e
Fix "double-indention" of one example
aphillips 81be51b
Remove final 'else'
aphillips 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 |
---|---|---|
|
@@ -19,7 +19,8 @@ | |
1. [Variants](#variants) | ||
1. [Patterns](#patterns) | ||
1. [Expressions](#expressions) | ||
1. [Reserved Sequences](#reserved) | ||
1. [Private-Use Sequences](#private-use) | ||
2. [Reserved Sequences](#reserved) | ||
Comment on lines
+22
to
+23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We might want to start using explicit |
||
1. [Tokens](#tokens) | ||
1. [Keywords](#keywords) | ||
1. [Text](#text) | ||
|
@@ -410,20 +411,56 @@ option = name [s] "=" [s] (literal / variable) | |
> {{+h1 name=above-and-beyond}Above And Beyond{-h1}} | ||
> ``` | ||
|
||
#### Private-Use | ||
|
||
A **_private-use_** _annotation_ is an _annotation_ whose syntax is reserved | ||
for use by a specific implementation or by private agreement between multiple implementations. | ||
Implementations MAY define their own meaning and semantics for _private-use_ annotations. | ||
|
||
A _private-use_ annotation starts with either U+0026 AMPERSAND `&` or U+005E CIRCUMFLEX ACCENT `^`. | ||
|
||
Characters, including whitespace, are assigned meaning by the implementation. | ||
The definition of escapes in the `reserved-body` production, used for the body of | ||
a _private-use_ annotation is an affordance to implementations that | ||
wish to use a syntax exactly like other functions. Specifically: | ||
* The characters `\`, `{`, and `}` MUST be escaped as `\\`, `\{`, and `\}` respectively | ||
when they appear in the body of a _private-use_ annotation. | ||
* The character `|` is special: it SHOULD be escaped as `\|` in a _private-use_ annotation, | ||
but can appear unescaped as long as it is paired with another `|`. This is an affordance to | ||
allow _literals_ to appear in the private use syntax. | ||
|
||
A _private-use_ _annotation_ MAY be empty after its introducing sigil. | ||
|
||
**NOTE:** Users are cautioned that _private-use_ sequences cannot be reliably exchanged | ||
and can result in errors during formatting. | ||
It is generally a better idea to use the function registry | ||
to define additional formatting or annotation options. | ||
|
||
```abnf | ||
private-use = private-start reserved-body | ||
private-start = "&" / "^" | ||
``` | ||
|
||
> Here are some examples of what _private-use_ sequences might look like: | ||
> ``` | ||
> {Here's private use with an operand: {$foo &bar}} | ||
> {Here's a placeholder that is entirely private-use: {&anything here}} | ||
> {Here's a private-use function that uses normal function syntax: {$operand ^foo option=|literal|}} | ||
> {The character \| has to be paired or escaped: {&private || |something between| or isolated: \| }} | ||
> {Stop {& "translate 'stop' as a verb" might be a translator instruction or comment }} | ||
> {Protect stuff in {^ph}<a>{^/ph}private use{^ph}</a>{^/ph}} | ||
>``` | ||
|
||
#### Reserved | ||
|
||
**_Reserved_** annotations start with a reserved character | ||
and are intended for future standardization | ||
as well as private implementation use. | ||
and are intended for future standardization. | ||
A _reserved_ _annotation_ MAY be empty or contain arbitrary text. | ||
This allows maximum flexibility in future standardization, | ||
as future definitions are expected to define additional semantics and constraints | ||
as future definitions MAY define additional semantics and constraints | ||
on the contents of these _annotations_. | ||
A _reserved_ _annotation_ does not include trailing whitespace. | ||
|
||
Implementations MAY define their own meaning and semantics for | ||
_reserved_ annotations that start with | ||
the U+0026 AMPERSAND `&` or U+005E CIRCUMFLEX ACCENT `^` characters. | ||
Implementations MUST NOT assign meaning or semantics to | ||
an _annotation_ starting with `reserved-start`: | ||
these are reserved for future standardization. | ||
|
@@ -433,9 +470,8 @@ While a reserved sequence is technically "well-formed", | |
unrecognized reserved sequences have no meaning and MAY result in errors during formatting. | ||
|
||
```abnf | ||
reserved = ( reserved-start / private-start ) reserved-body | ||
reserved = reserved-start reserved-body | ||
reserved-start = "!" / "@" / "#" / "%" / "*" / "<" / ">" / "/" / "?" / "~" | ||
private-start = "^" / "&" | ||
reserved-body = *( [s] 1*(reserved-char / reserved-escape / literal)) | ||
reserved-char = %x00-08 ; omit HTAB and LF | ||
/ %x0B-0C ; omit CR | ||
|
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.
This seems like a run-on sentence, and the "it" could be specified a bit more explicitly. Yes, I realise that I'm in part correcting my own suggestion here.