Incorrect BNF for properties-format
Closed this issue · 4 comments
Now:
properties-format = key-value-pair *(whitespace semicolon key-value-pair)
What most programs deliver:
properties-format = key-value-pair *(*whitespace semicolon whitespace key-value-pair)
What readers should parse:
properties-format = key-value-pair *(*whitespace semicolon *whitespace key-value-pair)
The first one is definitely wrong.
The problem I see with not requiring whitespace before/or after the the separating semicolon is that semicolon cannot be used in values then, e.g. parsing image imageserver?scale=1;width=100; bbox 0 0 100 100
.
The grammar at the moment forbids using semicolon for anything but delimiting kv-pairs and I haven't come across semicolon in URL in a while and in fact most implementations I've seen use \s*;\s*
as the separator. We can go with your second proposal, can you open a PR?
Further feedback or improvements, in particular for the grammar sections, is appreciated, it's more of a draft since I've never written an ABNF grammar before.
@kba Oh, yes, but then the BNF for property-value
is also wrong.
Now:
property-value = ascii-word *(whitespace ascii-word)
Where:
ascii-word = +(%x21-7E - semicolon) ; printable w/o space/semicolon
ascii-string = +(%x01-FF - semicolon) ; printable ascii without semicolon
delimited-string = doublequote ascii-string doublequote
Should be:
ascii-word = +(%x21-7E - semicolon) ; printable w/o space/semicolon
ascii-string = +(%x21-7E - doublequote) ; printable ascii without doublequote
delimited-string = doublequote ascii-string doublequote
property-value = (ascii-word / delimited-string) *(whitespace (ascii-word / delimited-string) )
And finally:
properties-format = key-value-pair *(*whitespace semicolon *whitespace key-value-pair)
This would allow:
image "imageserver?scale=1;width=100"; bbox 0 0 100 100
image "imageserver?scale=1;width=100" ; bbox 0 0 100 100
image "imageserver?scale=1;width=100" ;bbox 0 0 100 100
But this is invalid:
image imageserver?scale=1;width=100;
See also the grammar of the image
property:
property-name = "image"
property-value = delimited-string
The pull request was merged. Is this issue solved? Can it be closed?