qemu-patch-raspberry4/scripts
Markus Armbruster c7a3f25200 qapi.py: Restructure lexer and parser
The parser has a rather unorthodox structure:

    Until EOF:

        Read a section:

            Generator function get_expr() yields one section after the
            other, as a string.  An unindented, non-empty line that
            isn't a comment starts a new section.

        Lexing:

            Split section into a list of tokens (strings), with help
            of generator function tokenize().

        Parsing:

            Parse the first expression from the list of tokens, with
            parse(), throw away any remaining tokens.

            In parse_schema(): record value of an enum, union or
            struct key (if any) in the appropriate global table,
            append expression to the list of expressions.

    Return list of expressions.

Known issues:

(1) Indentation is significant, unlike in real JSON.

(2) Neither lexer nor parser have any idea of source positions.  Error
    reporting is hard, let's go shopping.

(3) The one error we bother to detect, we "report" via raise.

(4) The lexer silently ignores invalid characters.

(5) If everything in a section gets ignored, the parser crashes.

(6) The lexer treats a string containing a structural character exactly
    like the structural character.

(7) Tokens trailing the first expression in a section are silently
    ignored.

(8) The parser accepts any token in place of a colon.

(9) The parser treats comma as optional.

(10) parse() crashes on unexpected EOF.

(11) parse_schema() crashes when a section's expression isn't a JSON
    object.

Replace this piece of original art by a thoroughly unoriginal design.
Takes care of (1), (2), (5), (6) and (7), and lays the groundwork for
addressing the others.  Generated source files remain unchanged.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1374939721-7876-4-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-07-29 10:37:10 -05:00
..
kvm vmxcap: Update according to SDM of January 2013 2013-04-17 23:27:24 -03:00
qemu-guest-agent qemu-ga: sample fsfreeze hooks 2013-01-08 16:38:12 -06:00
tracetool trace: Add ftrace tracing backend 2013-05-03 13:58:09 +02:00
analyse-9p-simpletrace.py scripts/analyse-9p-simpletrace.py: Add symbolic names for 9p operations. 2011-12-21 12:37:23 +05:30
check-qerror.sh qerror: add check-qerror.sh to verify alphabetical order 2012-01-18 10:23:39 -02:00
checkpatch.pl CHECKPATCH: Add warning for single else statement. 2012-09-05 19:17:49 +00:00
cleanup-trace-events.pl cleanup-trace-events.pl: New 2013-07-18 11:44:42 +08:00
create_config main: use TARGET_ARCH only for the target-specific #define 2013-06-14 15:33:11 +01:00
feature_to_c.sh exec: move include files to include/exec/ 2012-12-19 08:31:31 +01:00
get_maintainer.pl get_maintainer.pl: update from linix 3.8 2012-12-12 23:41:03 +02:00
gtester-cat test makefile overhaul 2012-03-30 08:14:11 -05:00
hxtool vl.c: In qemu -h output, only print options for the arch we are running as 2011-12-19 10:27:33 -06:00
make-release build: add make dist target (v2) 2012-07-17 15:43:16 -05:00
make_device_config.sh make_device_config.sh: Emit dependency file to directory where included 2013-03-09 12:00:03 +00:00
ordereddict.py qapi: add ordereddict.py helper library 2011-07-21 16:48:14 -03:00
qapi-commands.py qapi: qapi-commands: fix possible leaks on visitor dealloc 2013-07-16 09:15:06 -04:00
qapi-types.py qapi: Anonymous unions 2013-07-26 21:10:11 +02:00
qapi-visit.py qapi: Anonymous unions 2013-07-26 21:10:11 +02:00
qapi.py qapi.py: Restructure lexer and parser 2013-07-29 10:37:10 -05:00
qemu-binfmt-conf.sh scripts/qemu-binfmt-conf.sh: Fix shell syntax 2012-05-08 11:15:18 -05:00
qemu-gdb.py scripts: add gdb support script 2012-03-24 12:57:02 +00:00
qtest qtest: add test framework 2012-03-30 08:14:11 -05:00
refresh-pxe-roms.sh PXE: Refresh all PXE ROMs from the ipxe submodule 2011-04-18 11:46:41 -06:00
signrom.py signrom: Rewrite as python script 2012-04-16 15:41:20 +02:00
simpletrace.py trace: Fix "Qemu" -> "QEMU" 2012-08-15 15:18:54 +01:00
texi2pod.pl Support utf8 chars in pod docs 2012-03-24 14:10:25 +00:00
tracetool.py build: do not use TARGET_ARCH 2013-06-14 15:33:10 +01:00
update-linux-headers.sh powerpc: linux header sync script includes epapr_hcalls.h 2013-01-07 17:37:09 +01:00