Nmap Development mailing list archives

Re: CouchDB and MongoDB


From: David Fifield <david () bamsoftware com>
Date: Sun, 28 Feb 2010 15:11:40 -0700

On Sat, Feb 27, 2010 at 10:25:49PM +0100, Martin Holst Swende wrote:
David Fifield wrote:
On Mon, Feb 22, 2010 at 11:09:09PM +0100, Martin Holst Swende wrote:
I have now rewritten the json library. I got tired of dealing with
state by passing parameters and return values, and made an OO-approach
(for the parser-part). It became much nicer. It also made it more easy
to handle errors, so the library now says stuff like

NSE: Json:Syntax error near pos 2: Expected '"', got 'a' input: {a":1}

I did not go all the way with a tokenizing lexer, a grammar etc - the
grammar is part of the parser flow, but otherwise I have skipped all
%b{} and such 'shortcuts' and parse character by character.
    

The new design looks really good. It has worked well in my testing.

I want you to change the names of the fromJson and toJson functions to
"parse" and "generate" respectively. The camelcase names don't fit with
the style of other libraries, and there's no need to have "json" twice
in calls like json.fromJson and json.fromJson.

First, thanks! I've committed the json library and the two CouchDB
scripts. I'm very happy with how the json library has turned out.

I renamed couchdb-get-stats to just couchdb-stats. I'm trying to avoid
superfluous "get" in script names when it's clear they are just getting
something.

After committing, I made some minor changes to json.lua, just some code
style things that I thought of. The only functional change I made was a
fix to what I think was a little bug: The sequence \\ was being
unescaped into the two bytes \\, instead of the one byte \.

David Fifield
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: