MAJOR=4 MINOR=66 DEVNAME=ttyS2  ˆ¾�þBg Á7H?Ç ƒh¹ÄÂÁ MAJOR=4 MINOR=55 DEVNAME=tty55  ˆÆÅÄ 409¿ÂÁ™ ‹¥’QoÓ0Çß÷)?ð¶\GÇ sŒFR‰J][uA!„\Û�­%qd+Û§_RmH›ÐÄ“ÏöÏÿ»ÿùø›rUTßÖ3ø\]-`ýåÓb^;Eü:-˪LçÙä q¶dÀ,Qÿq¿ßgûiæC�Õ-µÍ9F NQ¦I3qÂÇ3qÜ©‡89jŒ˜wÚü¿ô¿(:m&ïð^¶­ÔHm�J*kPÆh(bìƒW7ct;Í&ø³á˜DY<êò­×wcº³ÿ•eÊí!ÃÁÉ­l\ÝåŒ|Ïwm 1¨œ¡S¾‹¸mdw“ÕnÇ@6”³ïóbõcà�ìøZp 6˜]Î>ùòb•_2±”­á(Ÿg®³�‘ õÚíœÑ/Â× ¾v÷/ –‰)MTÁõä|÷ˆâ`ñ©U囨ËÁëûÁ� O©„èuCª¿š±¾ÜÌ–U9ߤ–èQⱺ×kLGPº`ùpw4“”ßvÛØ_üÙ±ÔàjKLœÂ³äkº€Çùàx<ŽiΑnÓ J  ˆÆÅÄ 603¿ÂÁ[ ‹½–[“š0Çß÷S¤yèDDÖ­‹t¶âL�uÕqé´�N‡‰$@¦Loýô ¢•¶Z{axÊíNÎ/9pb¿p§ïãlÞzOc0{÷f<¨!ôÞ äzn¹ÐÑ[Bà 0–2ï!´Ùlô�©g4XoÐR×^`¤àeš4'|:'À­‘z\�“£ÖˆE¯Í/ð;@GÑi3*S7 ’Ê”1ЇàÕíÝϲ3¬î8¦ìQ�‚|ëõÃôÎùkŽ©‡Âäö =…Ap²p/[×ô9#?0Á]×@ *gè”ï#n[Ùßf�Û1�-åìÇ¢Xÿ9$;e .Á³ËÙ§"_]®ó+&V²3åËÌub–2t^»�3úUø&Á7î÷ë‚ebJUp9ß?¡8Z|nUù6rôúat`Ãs*!ú_Ý�ê¯fTW›ùª.›Ô=IƒãaÔ8¦‘~jõ“à56ˆl–ßi~”Jj"T%ýÆÛ¸&TÅ£�þZ aY²�‘Èë,€óÈ „ Žˆ?ÅÃÂ?÷if not modules then modules = { } end modules ['util-jsn'] = { version = 1.001, comment = "companion to m-json.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", license = "see context related readme files" } -- Of course we could make a nice complete parser with proper error messages but -- as json is generated programmatically errors are systematic and we can assume -- a correct stream. If not, we have some fatal error anyway. So, we can just rely -- on strings being strings (apart from the unicode escape which is not in 5.1) and -- as we first catch known types we just assume that anything else is a number. -- -- Reminder for me: check usage in framework and extend when needed. Also document -- it in the cld lib documentation. -- -- Upgraded for handling the somewhat more fax server templates. if utilities and utilities.json then return json end local P, V, R, S, C, Cc, Cs, Ct, Cf, Cg = lpeg.P, lpeg.V, lpeg.R, lpeg.S, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Ct, lpeg.Cf, lpeg.Cg local lpegmatch = lpeg.match local format, gsub = string.format, string.gsub local formatters = string.formatters local utfchar = utf.char local concat, sortedkeys = table.concat, table.sortedkeys local tonumber, tostring, rawset, type, next = tonumber, tostring, rawset, type, next local json = utilities.json or { } utilities.json = json do -- \\ \/ \b \f \n \r \t \uHHHH local lbrace = P("{") local rbrace = P("}") local lparent = P("[") local rparent = P("]") local comma = P(",") local colon = P(":") local dquote = P('"') local whitespace = lpeg.patterns.whitespace local optionalws = whitespace^0 local escapes = { ["b"] = "\010", ["f"] = "\014", ["n"] = "\n", ["r"] = "\r", ["t"] = "\t", } -- todo: also handle larger utf16 local escape_un = P("\\u")/"" * (C(R("09","AF","af")^-4) / function(s) return utfchar(tonumber(s,16)) end) local escape_bs = P([[\]]) / "" * (P(1) / escapes) -- if not found then P(1) is returned i.e. the to be escaped char local jstring = dquote * Cs((escape_un + escape_bs + (1-dquote))^0) * dquote local jtrue = P("true") * Cc(true) local jfalse = P("false") * Cc(false) local jnull = P("null") *