From: Christian Linhart Date: Wed, 3 Sep 2014 11:17:57 +0000 (+0200) Subject: xcbgen: sumof with nested expression X-Git-Url: http://git.demorecorder.com/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=232dfe686e5022c46e058f463a4c10a2c8eada67;p=free-sw%2Fxcb%2Fproto xcbgen: sumof with nested expression Add parser support for sumof with a nested expression. For example: bar The nested expression is added as the "rhs"-field of the expression.object. Message-ID: <1409743080-302-4-git-send-email-chris@demorecorder.com> Patch-Thread-Subject: [Xcb] xinput: make ListInputDevices work, sumof with nested expr, ... Patch-Set: ListInputDevices Patch-Number: proto 4/7 Patch-Version: V1 Signed-off-by: Christian Linhart --- diff --git a/xcbgen/expr.py b/xcbgen/expr.py index 51e738f..ee2d3fd 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