#!/usr/bin/perl6
my Str $cookie = 'foo=bar,count=roo,date=kek';
grammar cookies {
token key { \w+ }
token value { <-[,]>+ }
token pair { <key> \h* '=' \h* <value> }
token TOP { <pair>* % [','+] }
}
say cookies.parse($cookie);
IyEvdXNyL2Jpbi9wZXJsNgpteSBTdHIgJGNvb2tpZSA9ICdmb289YmFyLGNvdW50PXJvbyxkYXRlPWtlayc7CmdyYW1tYXIgY29va2llcyB7CiAgICB0b2tlbiBrZXkgICAgIHsgXHcrIH0KICAgIHRva2VuIHZhbHVlICAgeyA8LVssXT4rIH0KICAgIHRva2VuIHBhaXIgICAgeyA8a2V5PiBcaCogJz0nIFxoKiA8dmFsdWU+IH0KICAgIHRva2VuIFRPUCAgICAgeyA8cGFpcj4qICUgWycsJytdIH0KfQpzYXkgY29va2llcy5wYXJzZSgkY29va2llKTs=