Ignore triple quotes in comments.

Sat, 23 Feb 2019 22:03:27 +0100

author
T.Rzepka <Tobias.Rzepka@gmail.com>
date
Sat, 23 Feb 2019 22:03:27 +0100
changeset 6813
7f4cfe76b90c
parent 6812
eddacf81a237
child 6814
7640753ca46e

Ignore triple quotes in comments.

Utilities/ClassBrowsers/pyclbr.py file | annotate | diff | comparison | revisions
Utilities/ModuleParser.py file | annotate | diff | comparison | revisions
--- a/Utilities/ClassBrowsers/pyclbr.py	Sat Feb 23 19:11:05 2019 +0100
+++ b/Utilities/ClassBrowsers/pyclbr.py	Sat Feb 23 22:03:27 2019 +0100
@@ -31,11 +31,13 @@
 _getnext = re.compile(
     r"""
     (?P<String>
-       \""" [^"\\]* (?:
+        \#[^\n]*$   # Ignore triple quotes in comments
+    |
+        \""" [^"\\]* (?:
                         (?: \\. | "(?!"") )
                         [^"\\]*
                     )*
-       \"""
+        \"""
 
     |   ''' [^'\\]* (?:
                         (?: \\. | '(?!'') )
--- a/Utilities/ModuleParser.py	Sat Feb 23 19:11:05 2019 +0100
+++ b/Utilities/ModuleParser.py	Sat Feb 23 22:03:27 2019 +0100
@@ -59,14 +59,18 @@
 
 _py_getnext = re.compile(
     r"""
-    (?P<String>
-       \""" (?P<StringContents1>
+    (?P<Comment>
+        \#[^\n]*$   # Ignore triple quotes in comments
+    )
+    
+|   (?P<String>
+        \""" (?P<StringContents1>
                [^"\\]* (?:
                             (?: \\. | "(?!"") )
                             [^"\\]*
                         )*
             )
-       \"""
+        \"""
 
     |   ''' (?P<StringContents2>
                 [^'\\]* (?:
@@ -813,6 +817,9 @@
                 conditionalsstack.append(thisindent)
                 deltaindentcalculated = 0
             
+            elif m.start("Comment") >= 0:
+                pass
+            
             else:
                 assert 0, "regexp _getnext found something unexpected"
             

eric ide

mercurial