File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change 22Tagset eBNF::
33
44 tagset = tag, { ",", tag };
5- tag = ( identifier - space ), "=", identifier;
6- identifier = { ? ASCII 32-126 ? - equal or comma };
5+ tag = key, "=", value;
6+ key = { ? ASCII 32-126 ? - equal or comma or space };
7+ value = { ? ASCII 32-126 ? - comma };
78 equal or comma = "=" | ",";
89 space = " ";
910"""
@@ -64,10 +65,9 @@ cdef inline int is_valid_key_char(int c):
6465
6566# Same as is_valid_key_char except spaces are allowed
6667cdef inline int is_valid_value_char(int c):
67- # string.printable - ",= "
68+ # string.printable - ","
6869 # 44 = ",""
69- # 61 = "="
70- return c == 32 or is_valid_key_char(c)
70+ return c == 32 or is_equal(c) or is_valid_key_char(c)
7171
7272
7373cpdef dict decode_tagset_string(str tagset):
Original file line number Diff line number Diff line change 2929 ("key=value," , {"key" : "value" }),
3030 # Values can have spaces
3131 ("key=value can have spaces" , {"key" : "value can have spaces" }),
32+ # Values can have equals
33+ ("key=value=value" , {"key" : "value=value" }),
3234 # Remove leading/trailing spaces from values
3335 ("key= value can have spaces " , {"key" : "value can have spaces" }),
3436 # Non-space whitespace characters are allowed
4143 "_dd.p.upstream_services=bWNudWx0eS13ZWI|0|1;dHJhY2Utc3RhdHMtcXVlcnk|2|4,_dd.p.hello=world" ,
4244 {"_dd.p.upstream_services" : "bWNudWx0eS13ZWI|0|1;dHJhY2Utc3RhdHMtcXVlcnk|2|4" , "_dd.p.hello" : "world" },
4345 ),
46+ (
47+ "_dd.p.upstream_services=bWNudWx0eS13ZWI===|0|1;dHJhY2Utc3RhdHMtcXVlcnk===|2|4,_dd.p.hello=world" ,
48+ {
49+ "_dd.p.upstream_services" : "bWNudWx0eS13ZWI===|0|1;dHJhY2Utc3RhdHMtcXVlcnk===|2|4" ,
50+ "_dd.p.hello" : "world" ,
51+ },
52+ ),
4453 ],
4554)
4655def test_decode_tagset_string (header , expected ):
@@ -61,7 +70,6 @@ def test_decode_tagset_string(header, expected):
6170 "=value" ,
6271 # Extra leading comma
6372 ",key=value" ,
64- "key=value=value" ,
6573 "key=value,=value" ,
6674 "key=value,value" ,
6775 # Spaces are not allowed in keys
You can’t perform that action at this time.
0 commit comments