summaryrefslogtreecommitdiff
path: root/xcbgen
diff options
context:
space:
mode:
authorChristian Linhart <chris@DemoRecorder.com>2014-11-02 13:47:29 +0100
committerChristian Linhart <chris@demorecorder.com>2014-11-03 11:23:22 +0100
commit8c5c89f9f6c8e2b7334bdf19d47209e1ade4ef7c (patch)
tree4f22b92ccc7cd908878c8045079813887872b311 /xcbgen
parentc057c4336fb4fd2b65052536629383aa03ddf518 (diff)
downloadxcb-proto-8c5c89f9f6c8e2b7334bdf19d47209e1ade4ef7c.tar.gz
xcbgen: sumof with nested expression
Add parser support for sumof with a nested expression. For example: <sumof ref="mylist1"> <fieldref>bar</fieldref> </sumof> The nested expression is added as the "rhs"-field of the expression.object. Signed-off-by: Christian Linhart <chris@demorecorder.com> Reviewed-by: Ran Benita <ran234@gmail.com> Message-ID: <545627E1.8070302@DemoRecorder.com> Patch-Thread-Subject: [Xcb] [PATCHSET] ListInputDevices revision 2 Patch-Set: ListInputDevices Patch-Number: proto 4/8 Patch-Version: V1
Diffstat (limited to 'xcbgen')
-rw-r--r--xcbgen/expr.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/xcbgen/expr.py b/xcbgen/expr.py
index 51e738f..a03703f 100644
--- a/xcbgen/expr.py
+++ b/xcbgen/expr.py
@@ -104,6 +104,12 @@ class Expression(object):
elif elt.tag == 'sumof':
self.op = 'sumof'
self.lenfield_name = elt.get('ref')
+ subexpressions = list(elt)
+ if len(subexpressions) > 0:
+ # sumof with a nested expression which is to be evaluated
+ # for each list-element in the context of that list-element.
+ # sumof then returns the sum of the results of these evaluations
+ self.rhs = Expression(subexpressions[0], parent)
else:
# Notreached