diff options
author | Johan Bilien <jobi@via.ecp.fr> | 2008-10-12 21:12:46 +0000 |
---|---|---|
committer | Johan Bilien <jobi@src.gnome.org> | 2008-10-12 21:12:46 +0000 |
commit | 86de883a84eaf0bd4935c0eec74441df2c49b23a (patch) | |
tree | 392a5c80bfed9011d44640c5a761f0484275bfe6 /giscanner/girparser.py | |
parent | 4a75911d4251128de1d2beff53c5a6a0b90d03d7 (diff) | |
download | gobject-introspection-86de883a84eaf0bd4935c0eec74441df2c49b23a.tar.gz |
parse constant nodes in gir files
2008-10-12 Johan Bilien <jobi@via.ecp.fr>
* giscanner/girparser.py: parse constant nodes in gir files
svn path=/trunk/; revision=695
Diffstat (limited to 'giscanner/girparser.py')
-rw-r--r-- | giscanner/girparser.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/giscanner/girparser.py b/giscanner/girparser.py index 640eaef8..8b72ad77 100644 --- a/giscanner/girparser.py +++ b/giscanner/girparser.py @@ -20,8 +20,9 @@ from xml.etree.cElementTree import parse -from .ast import (Alias, Array, Callback, Enum, Function, Field, Namespace, - Parameter, Property, Return, Union, Struct, Type, Varargs) +from .ast import (Alias, Array, Callback, Constant, Enum, Function, Field, + Namespace, Parameter, Property, Return, Union, Struct, Type, + Varargs) from .glibast import (GLibEnum, GLibEnumMember, GLibFlags, GLibInterface, GLibObject, GLibBoxedStruct, GLibBoxedUnion, GLibBoxedOther) @@ -111,6 +112,8 @@ class GIRParser(object): elif node.tag in [_corens('enumeration'), _corens('bitfield')]: self._parse_enumeration_bitfield(node) + elif node.tag in _corens('constant'): + self._parse_constant(node) def _parse_alias(self, node): return Alias(node.attrib['name'], @@ -253,6 +256,12 @@ class GIRParser(object): node.attrib.get(_cns('identifier')), node.attrib.get(_glibns('nick'))) + def _parse_constant(self, node): + type_node = self._parse_type(node) + return Constant(node.attrib['name'], + type_node.name, + node.attrib['value']) + def _parse_enumeration_bitfield(self, node): name = node.attrib.get('name') ctype = node.attrib.get(_cns('type')) |