diff options
author | Marcin KoĆcielnicki <koriakin@0x04.net> | 2010-05-13 21:05:58 +0000 |
---|---|---|
committer | Julien Danjou <julien@danjou.info> | 2010-05-14 13:19:14 +0200 |
commit | 70e270182fd523a6ea2270d8cf9ad21960dd0f74 (patch) | |
tree | e8a01cd824538974e7b14b9ddf100c77601f9bfc /xcbgen | |
parent | dae6b32d78f1a4ee30229d7f944ca6528aa50a7d (diff) |
xcbgen: Add unop support
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Julien Danjou <julien@danjou.info>
Diffstat (limited to 'xcbgen')
-rw-r--r-- | xcbgen/expr.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/xcbgen/expr.py b/xcbgen/expr.py index ed4b975..79ad8f6 100644 --- a/xcbgen/expr.py +++ b/xcbgen/expr.py @@ -26,7 +26,7 @@ class Expression(object): Represents a mathematical expression for a list length or exprfield. Public fields: - op is the operation (text +,*,/,<<) or None. + op is the operation (text +,*,/,<<,~) or None. lhs and rhs are the sub-Expressions if op is set. lenfield_name is the name of the length field, or None for request lists. lenfield is the Field object for the length field, or None. @@ -75,6 +75,13 @@ class Expression(object): if self.lenfield_name == None: self.lenfield_name = self.rhs.lenfield_name + elif elt.tag == 'unop': + # Op field. Need to recurse. + self.op = elt.get('op') + self.rhs = Expression(list(elt)[0], parent) + + self.lenfield_name = self.rhs.lenfield_name + elif elt.tag == 'value': # Constant expression self.nmemb = int(elt.text, 0) |