qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 0/11] json parser (v2)


From: Anthony Liguori
Subject: [Qemu-devel] [PATCH 0/11] json parser (v2)
Date: Sat, 17 Oct 2009 08:36:00 -0500

I fat-fingered the git send-email command the first time so here's the second
iteration.

This series introduces a json parsing framework.  The parser is a recursive
decent parser and implements the full json spec except for the null keyword.  We
need to decide how we want to model null in order to support this.

In addition, we implement an extension to allow single quote strings.  This
is very useful for defining dictionaries in C.

The parser has a full test suite and introduces a boolean and float type.

It also supports varargs parsing.  Here's an example of how that works:

  QObject *obj;

  obj = qobject_from_jsonf("{'id': %d, {'locked': %i, 'file': %s}}",
                           NULL,
                           bs->id, bs->locked, bs->file);

The parser also can embed full qobjects with the '%p' format.

To do streaming parsing, we need a lexer that can tokenize the input.  We then
just need a simple counter to look for balanced {'s and ['s.  The lexer can
just be a regular expression so it's pretty straight forward.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]