Utilities/ModuleParser.py

changeset 6815
b1b833693a38
parent 6813
7f4cfe76b90c
--- a/Utilities/ModuleParser.py	Sun Feb 24 12:13:56 2019 +0100
+++ b/Utilities/ModuleParser.py	Sun Feb 24 13:01:43 2019 +0100
@@ -60,7 +60,7 @@
 _py_getnext = re.compile(
     r"""
     (?P<Comment>
-        \#[^\n]*$   # Ignore triple quotes in comments
+        \# .*? $   # ignore everything in comments
     )
     
 |   (?P<String>
@@ -532,7 +532,7 @@
         deltaindent = 0
         deltaindentcalculated = 0
         i = 0
-        modulelevel = 1
+        modulelevel = True
         cur_obj = self
         modifierType = Function.General
         modifierIndent = -1
@@ -652,7 +652,7 @@
                     if self.file.lower().endswith('.ptl'):
                         contents = ""
                     else:
-                        contents = 1 and m.group("DocstringContents1") \
+                        contents = m.group("DocstringContents1") \
                             or m.group("DocstringContents2")
                 if cur_obj:
                     cur_obj.addDescription(contents)
@@ -669,7 +669,7 @@
                         if self.file.lower().endswith('.ptl'):
                             contents = ""
                         else:
-                            contents = 1 and m.group("StringContents1") \
+                            contents = m.group("StringContents1") \
                                 or m.group("StringContents2")
                     if cur_obj:
                         cur_obj.addDescription(contents)
@@ -818,12 +818,13 @@
                 deltaindentcalculated = 0
             
             elif m.start("Comment") >= 0:
-                pass
+                if modulelevel:
+                    continue
             
             else:
                 assert 0, "regexp _getnext found something unexpected"
             
-            modulelevel = 0
+            modulelevel = False
     
     def __rb_scan(self, src):
         """

eric ide

mercurial