gobject-introspection r695 - in trunk: . giscanner



Author: jobi
Date: Sun Oct 12 21:12:46 2008
New Revision: 695
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=695&view=rev

Log:

2008-10-12  Johan Bilien  <jobi via ecp fr>

	* giscanner/girparser.py: parse constant nodes in gir files



Modified:
   trunk/ChangeLog
   trunk/giscanner/girparser.py

Modified: trunk/giscanner/girparser.py
==============================================================================
--- trunk/giscanner/girparser.py	(original)
+++ trunk/giscanner/girparser.py	Sun Oct 12 21:12:46 2008
@@ -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 @@
         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 @@
                               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'))



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]