Skip to content

Commit 21ff721

Browse files
committed
CLDR-18318 kbd: escaping: update to EBNF/ABNF
- update ebnf in the spec - update abnf in data files - update test cases
1 parent 0c12ecd commit 21ff721

File tree

4 files changed

+56
-12
lines changed

4 files changed

+56
-12
lines changed

docs/ldml/tr35-keyboards.md

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2233,7 +2233,7 @@ _Attribute:_ `from` (required)
22332233
`{x,y}`
22342234

22352235
`x` and `y` are required single digits (`1` to `9`) representing the minimum and maximum number of occurrences.
2236-
2236+
22372237
`x` must be ≥ 0, `y` must be ≥ x and ≥ 1.
22382238

22392239
Unbounded quantifiers such as `{3,}` are not allowed.
@@ -2515,20 +2515,17 @@ fixed-class-char
25152515
| 'n'
25162516
| 'f'
25172517
| 'v'
2518-
| '\'
2519-
| '$'
25202518
| 'd'
25212519
| 'w'
25222520
| 'D'
25232521
| 'W'
2524-
| '0'
25252522
set-class
25262523
::= '[' set-negator set-members ']'
25272524
set-members
25282525
::= set-member+
25292526
set-member
2530-
::= text-char
2531-
| char-range
2527+
::= char-range
2528+
| range-char
25322529
| match-marker
25332530
| escaped-codepoint
25342531
char-range
@@ -2547,7 +2544,7 @@ text-char
25472544
range-char
25482545
::= content-char
25492546
| ws
2550-
| escaped-char
2547+
| escaped-range-char
25512548
| '.'
25522549
| '|'
25532550
| '{'
@@ -2558,7 +2555,28 @@ content-char
25582555
| DIGIT
25592556
| NON-ASCII
25602557
escaped-char
2561-
::= '\' ( '\' | '{' | '|' | '}' )
2558+
::= '\' escapable-char
2559+
escapable-char
2560+
::= '\'
2561+
| '$'
2562+
| '{'
2563+
| '|'
2564+
| '}'
2565+
| '('
2566+
| ')'
2567+
| '*'
2568+
| '+'
2569+
| '.'
2570+
| '/'
2571+
| '?'
2572+
| '['
2573+
| ']'
2574+
| '^'
2575+
escaped-range-char
2576+
::= '\' escapable-range-char
2577+
escapable-range-char
2578+
::= escapable-char
2579+
| '-'
25622580
ws ::= [ #x3000]
25632581
| HTAB
25642582
| CR

keyboards/abnf/transform-from-required.abnf

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ class = fixed-class / set-class
8181

8282
fixed-class = backslash fixed-class-char
8383

84-
fixed-class-char = "s" / "S" / "t" / "r" / "n" / "f" / "v" / backslash / "$" / "d" / "w" / "D" / "W" / "0"
84+
fixed-class-char = "s" / "S" / "t" / "r" / "n" / "f" / "v" / "d" / "w" / "D" / "W"
8585

8686
set-class = "[" set-negator set-members "]"
8787
set-members = set-member *(set-member)
88-
set-member = text-char / char-range / match-marker / escaped-codepoint
88+
set-member = char-range / range-char / match-marker / escaped-codepoint
8989
char-range = range-edge "-" range-edge
9090
range-edge = escaped-codepoint / range-char
9191
set-negator = "^" / ""
@@ -95,12 +95,16 @@ set-negator = "^" / ""
9595
; normal text
9696
text-char = content-char / ws / escaped-char / "-" / ":"
9797
; text in a range sequence
98-
range-char = content-char / ws / escaped-char / "."/ "|" / "{" / "}"
98+
range-char = content-char / ws / escaped-range-char / "." / "|" / "{" / "}"
9999
; group for everything BUT syntax chars.
100100
content-char = ASCII-PUNCT / ALPHA / DIGIT / NON-ASCII
101101

102102
; Character escapes
103-
escaped-char = backslash ( backslash / "{" / "|" / "}" )
103+
escaped-char = backslash ( escapable-char )
104+
escapable-char = backslash / "$" / "{" / "|" / "}" / "(" / ")" / "*" / "+" / "." / "/" / "?" / "[" / "]" / "^"
105+
106+
escaped-range-char = backslash escapable-range-char
107+
escapable-range-char = escapable-char / "-"
104108

105109
backslash = %x5C ; U+005C REVERSE SOLIDUS "\"
106110
ws = SP / HTAB / CR / LF / %x3000

tools/scripts/keyboard-abnf-tests/transform-from-required.d/from-match.fail.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,6 @@ e(abc)+g
3333
# end marker
3434
Foo$
3535
^Foo$
36+
\0
37+
\a
38+
\1

tools/scripts/keyboard-abnf-tests/transform-from-required.d/from-match.pass.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,22 @@ abc|def
2020
##(?:foo(?:bar(baz(bat))?))
2121
\m{q}:
2222
\m{q}ড\m{.}
23+
\$
24+
\(
25+
\)
26+
\*
27+
\+
28+
\.
29+
\/
30+
\?
31+
\[
32+
\\
33+
\]
34+
\^
35+
\{
36+
\|
37+
\}
38+
z[0-9]?
39+
z[0-9\-]?
40+
z[^0-9]?
41+
z[^0-9\-]?

0 commit comments

Comments
 (0)