8000 Correct bogus ABNF syntax matching literal numbers (#614) · unicode-org/message-format-wg@f9b0c6f · GitHub
[go: up one dir, main page]

Skip to content

Commit f9b0c6f

Browse files
authored
Correct bogus ABNF syntax matching literal numbers (#614)
The `0` here was evidently meant to represent a literal character 0, but as I understand ABNF this would be interpreted as a counter modifier for a later item. It would be quoted as a string `"0"`, but the later range `[0-9]` is not quite so easy. To be a range one kind of needs to specify the actual character codes (as is done elsewhere in this very grammar). I encoded the zero as `%x30` and the range one-to-nine as `%x31-39` so all the literal digits are represented the same way.
1 parent 4784fb9 commit f9b0c6f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

spec/message.abnf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ literal = quoted / unquoted
4949
quoted = "|" *(quoted-char / quoted-escape) "|"
5050
unquoted = name / number-literal
5151
; number-literal matches JSON number (https://www.rfc-editor.org/rfc/rfc8259#section-6)
52-
number-literal = ["-"] (0 / ([1-9] *DIGIT)) ["." 1*DIGIT] [%i"e" ["-" / "+"] 1*DIGIT]
52+
number-literal = ["-"] (%x30 / (%x31-39 *DIGIT)) ["." 1*DIGIT] [%i"e" ["-" / "+"] 1*DIGIT]
5353

5454
; Keywords; Note that these are case-sensitive
5555
input = %s".input"

0 commit comments

Comments
 (0)
0