eric6/Utilities/ClassBrowsers/idlclbr.py

changeset 7690
a59680062837
parent 7685
0b6e8c0d6403
child 7699
d338c533f5f0
--- a/eric6/Utilities/ClassBrowsers/idlclbr.py	Fri Sep 04 18:48:52 2020 +0200
+++ b/eric6/Utilities/ClassBrowsers/idlclbr.py	Fri Sep 04 18:50:43 2020 +0200
@@ -199,7 +199,6 @@
         VisibilityMixin.__init__(self)
 
 
-# TODO: extract scan function (see pyclbr)
 def readmodule_ex(module, path=None):
     """
     Read a CORBA IDL file and return a dictionary of classes, functions and
@@ -214,9 +213,6 @@
     """
     global _modules
     
-    dictionary = {}
-    dict_counts = {}
-
     if module in _modules:
         # we've seen this file before...
         return _modules[module]
@@ -229,21 +225,42 @@
         f.close()
     if type not in SUPPORTED_TYPES:
         # not CORBA IDL source, can't do anything with this module
-        _modules[module] = dictionary
-        return dictionary
+        _modules[module] = {}
+        return {}
 
-    _modules[module] = dictionary
-    classstack = []  # stack of (class, indent) pairs
-    indent = 0
     try:
         src = Utilities.readEncodedFile(file)[0]
     except (UnicodeError, IOError):
         # can't do anything with this module
-        _modules[module] = dictionary
-        return dictionary
+        _modules[module] = {}
+        return {}
+    
+    _modules[module] = scan(src, file, module)
+    return _modules[module]
+
+
+def scan(src, file, module):
+    """
+    Public method to scan the given source text.
+    
+    @param src source text to be scanned
+    @type str
+    @param file file name associated with the source text
+    @type str
+    @param module module name associated with the source text
+    @type str
+    @return dictionary containing the extracted data
+    @rtype dict
+    """
     # convert eol markers the Python style
     src = src.replace("\r\n", "\n").replace("\r", "\n")
 
+    dictionary = {}
+    dict_counts = {}
+
+    classstack = []  # stack of (class, indent) pairs
+    indent = 0
+    
     lineno, last_lineno_pos = 1, 0
     lastGlobalEntry = None
     cur_obj = None

eric ide

mercurial