From: Mischa POSLAWSKY Date: Thu, 12 Feb 2015 05:17:10 +0000 (+0100) Subject: browser: drop legacy caniuse format parsing support X-Git-Tag: v1.7~162 X-Git-Url: http://git.shiar.nl/sheet.git/commitdiff_plain/a8c39dd96b809107ce0029a6a26f37bfbf33b6bf browser: drop legacy caniuse format parsing support --- diff --git a/tools/mkcaniuse b/tools/mkcaniuse index d0cb827..eaadead 100755 --- a/tools/mkcaniuse +++ b/tools/mkcaniuse @@ -13,30 +13,7 @@ our $VERSION = '1.01'; local $/; # slurp my $source = readline; -for ($source) { # cleanup - s/\A\(// and s/\);?\s*\Z//; # empty callback - next if /^\{/; # valid json - - # convert seperate variables to hash keys - s/\A/{\n/; - s/^caniuse\.(\w+) *= */"$1":/gm; - s/;$/,/gm; - s/,\s*\Z/\n}/; - # fractions not supported by barekey - s/(?<=[,{\n]) (\d*\.\d) (?=:['"])/"$1"/gx; - # escapes not supported in singlequote - s{: *\K'((?:[^\\']+|\\.)*)'}{ - my $_ = $1; - s/"/\\"/g; - s/\\'/'/g; - qq("$_"); - }ge; -} - -my $data = from_json($source, { - allow_singlequote => 1, - allow_barekey => 1, -}); +my $data = from_json($source); my $update = eval { stat(${^LAST_FH} // $ARGV)->mtime } or warn "Could not determine input time\n"; $data->{-date} = Time::Piece->new($update)->datetime;