summaryrefslogtreecommitdiffstats
path: root/scripts/qapi-commands.py
diff options
context:
space:
mode:
authorMarkus Armbruster2015-09-16 13:06:05 +0200
committerMarkus Armbruster2015-09-21 09:31:29 +0200
commitac88219a6c78302c693fb60fe6cf04358540fbce (patch)
tree40653063ef930e38a44fb7b0a3f96ae92f8ef55c /scripts/qapi-commands.py
parentqapi: Rename class QAPISchema to QAPISchemaParser (diff)
downloadqemu-ac88219a6c78302c693fb60fe6cf04358540fbce.tar.gz
qemu-ac88219a6c78302c693fb60fe6cf04358540fbce.tar.xz
qemu-ac88219a6c78302c693fb60fe6cf04358540fbce.zip
qapi: New QAPISchema intermediate reperesentation
The QAPI code generators work with a syntax tree (nested dictionaries) plus a few symbol tables (also dictionaries) on the side. They have clearly outgrown these simple data structures. There's lots of rummaging around in dictionaries, and information is recomputed on the fly. For the work I'm going to do, I want more clearly defined and more convenient interfaces. Going forward, I also want less coupling between the back-ends and the syntax tree, to make messing with the syntax easier. Create a bunch of classes to represent QAPI schemata. Have the QAPISchema initializer call the parser, then walk the syntax tree to create the new internal representation, and finally perform semantic analysis. Shortcut: the semantic analysis still relies on existing check_exprs() to do the actual semantic checking. All this code needs to move into the classes. Mark as TODO. Simple unions are lowered to flat unions. Flat unions and structs are represented as a more general object type. Catching name collisions in generated code would be nice. Mark as TODO. We generate array types eagerly, even though most of them aren't used. Mark as TODO. Nothing uses the new intermediate representation just yet, thus no change to generated files. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'scripts/qapi-commands.py')
-rw-r--r--scripts/qapi-commands.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/qapi-commands.py b/scripts/qapi-commands.py
index 890ce5db92..12bdc4cc4b 100644
--- a/scripts/qapi-commands.py
+++ b/scripts/qapi-commands.py
@@ -272,7 +272,7 @@ for o, a in opts:
if o in ("-m", "--middle"):
middle_mode = True
-exprs = parse_schema(input_file)
+exprs = QAPISchema(input_file).get_exprs()
commands = filter(lambda expr: expr.has_key('command'), exprs)
commands = filter(lambda expr: not expr.has_key('gen'), commands)