On Tue, Apr 26, 2011 at 11:35 PM, bill lam <[email protected]> wrote: > Inside Raul's json parser,
It's been a long time since I wrote that thing, I had forgotten about it. > NB. Example use: > evalbs 'test\\..' > test\\.. > > I expected it should output test\.. Yes, that's a bug. I think this should fix it: hexchars=. 'ABCDEF0123456789abcdef' splitbs=: (0;(0 10#:10*".;._2]0 :0);(a.e.hexchars,'Uu')+2*a.='\')&;: 1.1 1.1 2.1 NB. state 0 -- start 1.0 1.0 2.2 NB. state 1 -- ordinary characters 3.0 4.0 7.0 NB. state 2 -- \ 1.2 1.2 1.2 NB. state 3 -- \n or \u0000 (last character in backslash escape) 1.2 5.0 1.2 NB. state 4 -- \u 1.2 6.0 1.2 NB. state 5 -- \u0 1.2 7.0 1.2 NB. state 6 -- \u00 1.2 3.0 1.2 NB. state 7 -- \u000 ) But it needs a proper test suite, and not me making changes when I am half asleep. -- Raul ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
