Skip to content
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

Add bidi support and address UAX31/UTS55 requirements #884

Merged
merged 28 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
82fcef3
Add bidi support and address UAX31/UTS55 requirements
aphillips Sep 11, 2024
c5baba6
Update syntax.md including text from previous PR
aphillips Sep 11, 2024
ca63819
Repair the guidance on strongly directional marks
aphillips Sep 11, 2024
1e172fd
Fix formatting of the "important"
aphillips Sep 11, 2024
afd5ef0
Add bidi characters to description of whitespace.
aphillips Sep 11, 2024
c7a41fc
Permit bidi in a few more places
aphillips Sep 11, 2024
b0cd0a5
Update syntax.md ABNF
aphillips Sep 11, 2024
cacc5e9
Update formatting.md
aphillips Sep 11, 2024
1fb0f92
Address comment about name/identifier
aphillips Sep 11, 2024
a79fb8d
Address comments related to bidi in `name`
aphillips Sep 11, 2024
86a20f8
Fix variable's location
aphillips Sep 11, 2024
768a8a8
Address comment about the list of LRI/PDI targets
aphillips Sep 11, 2024
fd9fc57
One character typo :-P
aphillips Sep 11, 2024
734ef49
Update spec/syntax.md
aphillips Sep 12, 2024
4541758
Address comments about rule R3a-1
aphillips Sep 12, 2024
d751181
Update spec/syntax.md
aphillips Sep 12, 2024
cbd0457
Address comment about U+061C
aphillips Sep 12, 2024
0df963e
Change [o]wsp => `o` or `s`
aphillips Sep 12, 2024
be8fa43
Match syntax spec to abnf
aphillips Sep 12, 2024
f110af7
Remove *
aphillips Sep 12, 2024
d8c6d0f
Update syntax.md
aphillips Sep 12, 2024
d5fb3bb
Update spec/syntax.md
aphillips Sep 12, 2024
82af41f
Update spec/message.abnf
aphillips Sep 12, 2024
d9d79bc
Update spec/message.abnf
aphillips Sep 12, 2024
7858961
Update syntax.md
aphillips Sep 12, 2024
e7aa24c
Update spec/message.abnf
aphillips Sep 12, 2024
86fc1d4
Update spec/syntax.md
aphillips Sep 12, 2024
d5303c2
Update spec/syntax.md
aphillips Sep 12, 2024
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
11 changes: 10 additions & 1 deletion spec/formatting.md
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,16 @@ That is, the text can can consist of a mixture of left-to-right and right-to-lef
The display of bidirectional text is defined by the
[Unicode Bidirectional Algorithm](http://www.unicode.org/reports/tr9/) [UAX9].

The directionality of the message as a whole is provided by the _formatting context_.
The directionality of the formatted _message_ as a whole is provided by the _formatting context_.

> [!NOTE]
> Keep in mind the difference between the formatted output of a _message_,
> which is the topic of this section,
> and the syntax of _message_ prior to formatting.
> The processing of a _message_ depends on the logical sequence of Unicode code points,
> not on the presentation of the _message_.
> Affordances to allow users appropriate control over the appearance of the
> _message_'s syntax have been provided.

When a _message_ is formatted, _placeholders_ are replaced
with their formatted representation.
Expand Down
52 changes: 31 additions & 21 deletions spec/message.abnf
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
message = simple-message / complex-message

simple-message = [s] [simple-start pattern]
simple-message = owsp [simple-start pattern]
simple-start = simple-start-char / escaped-char / placeholder
pattern = *(text-char / escaped-char / placeholder)
placeholder = expression / markup

complex-message = [s] *(declaration [s]) complex-body [s]
complex-message = owsp *(declaration owsp) complex-body owsp
declaration = input-declaration / local-declaration
complex-body = quoted-pattern / matcher

input-declaration = input [s] variable-expression
local-declaration = local s variable [s] "=" [s] expression
input-declaration = input owsp variable-expression
local-declaration = local wsp variable owsp "=" owsp expression

quoted-pattern = "{{" pattern "}}"
quoted-pattern = owsp "{{" pattern "}}" owsp

matcher = match-statement s variant *([s] variant)
match-statement = match 1*(s selector)
matcher = match-statement wsp variant *(owsp variant)
match-statement = match 1*(wsp selector)
selector = variable
variant = key *(s key) [s] quoted-pattern
variant = owsp key *(wsp key) quoted-pattern
key = literal / "*"

; Expressions
expression = literal-expression
/ variable-expression
/ function-expression
literal-expression = "{" [s] literal [s function] *(s attribute) [s] "}"
variable-expression = "{" [s] variable [s function] *(s attribute) [s] "}"
function-expression = "{" [s] function *(s attribute) [s] "}"
literal-expression = "{" owsp literal [wsp function] *(wsp attribute) owsp "}"
variable-expression = "{" owsp variable [wsp function] *(wsp attribute) owsp "}"
function-expression = "{" owsp function *(wsp attribute) owsp "}"

markup = "{" [s] "#" identifier *(s option) *(s attribute) [s] ["/"] "}" ; open and standalone
/ "{" [s] "/" identifier *(s option) *(s attribute) [s] "}" ; close
markup = "{" owsp "#" identifier *(wsp option) *(wsp attribute) owsp ["/"] "}" ; open and standalone
/ "{" owsp "/" identifier *(wsp option) *(wsp attribute) owsp "}" ; close

; Expression and literal parts
function = ":" identifier *(s option)
option = identifier [s] "=" [s] (literal / variable)
function = ":" identifier *(wsp option)
option = identifier owsp "=" owsp (literal / variable)

attribute = "@" identifier [[s] "=" [s] (literal / variable)]
attribute = "@" identifier [owsp "=" owsp (literal / variable)]

variable = "$" name

Expand All @@ -52,13 +52,13 @@ match = %s".match"

; Names and identifiers
; identifier matches https://www.w3.org/TR/REC-xml-names/#NT-QName
; name matches https://www.w3.org/TR/REC-xml-names/#NT-NCName but excludes U+FFFD
; name matches https://www.w3.org/TR/REC-xml-names/#NT-NCName but excludes U+FFFD and U+061C
identifier = [namespace ":"] name
namespace = name
name = name-start *name-char
name = [bidi] name-start *name-char [bidi]
name-start = ALPHA / "_"
/ %xC0-D6 / %xD8-F6 / %xF8-2FF
/ %x370-37D / %x37F-1FFF / %x200C-200D
/ %x370-37D / %x37F-61B / %x61D-1FFF / %x200C-200D
/ %x2070-218F / %x2C00-2FEF / %x3001-D7FF
/ %xF900-FDCF / %xFDF0-FFFC / %x10000-EFFFF
name-char = name-start / DIGIT / "-" / "."
Expand All @@ -83,5 +83,15 @@ content-char = %x01-08 ; omit NULL (%x00), HTAB (%x09) and LF (%x0A)
escaped-char = backslash ( backslash / "{" / "|" / "}" )
backslash = %x5C ; U+005C REVERSE SOLIDUS "\"

; Whitespace
s = 1*( SP / HTAB / CR / LF / %x3000 )
; Optional whitespace
owsp = *(s / bidi)

; Required whitespace
wsp = (owsp) 1*s (owsp)

; Bidirectional marks and isolates
; ALM / LRM / RLM / LRI, RLI, FSI & PDI
bidi = %x061C / %x200E / %x200F / %x2066-2069

; Whitespace characters
s = SP / HTAB / CR / LF / %x3000
Loading