Skip to content

Commit

Permalink
Allow trailing commas in all comma-separated lists
Browse files Browse the repository at this point in the history
  • Loading branch information
cabo committed Aug 23, 2023
1 parent 03097b6 commit 61748e1
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions cbor-diag-parser.abnf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
seq = S [item S *("," S item S)] S
seq = S [item S *("," S item S) OC] S
item = map / array / tagged
/ basenumber / decnumber / infin / simple
/ tstr / bstr / embedded / streamstring
Expand Down Expand Up @@ -26,18 +26,21 @@ bstr = app-string / sqstr ; app could be any type
tstr = DQUOTE *double-quoted DQUOTE
embedded = "<<" seq ">>"

array = "[" spec [item S *("," S item S)] "]"
map = "{" spec [kp S *("," S kp S)] "}"
array = "[" spec [item S *("," S item S) OC] "]"
map = "{" spec [kp S *("," S kp S) OC] "}"
kp = item S ":" S item

; We allow %x09 HT in prose, but not in strings
blank = %x09 / %x0A / %x0D / %x20
non-slash = blank / %x21-2e / %x2f-10FFFF
S = *blank *("/" *non-slash "/" *blank )

; optional trailing comma (ignored)
OC = ["," S]

; note that there must be at least one string to distinguish
streamstring = "(" spec1 tstr S *("," S tstr S) ")"
/ "(" spec1 sqstr S *("," S sqstr S) ")"
streamstring = "(" spec1 tstr S *("," S tstr S) OC ")"
/ "(" spec1 sqstr S *("," S sqstr S) OC ")"
spec = S ["_" S]
spec1 = S "_" S

Expand Down

0 comments on commit 61748e1

Please sign in to comment.