]> granicus.if.org Git - python/commitdiff
Ever-so-slight improvementL the patterns to recognize import
authorGuido van Rossum <guido@python.org>
Tue, 13 Oct 1998 16:12:36 +0000 (16:12 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 13 Oct 1998 16:12:36 +0000 (16:12 +0000)
statements now also stop at ';' (formerly they only stopped at '#').

Lib/pyclbr.py

index 6af46920743eec04855c2d36cb8dce203a2551ce..25fc33f44e084160ef8d4f3a104c3113062e881d 100644 (file)
@@ -42,8 +42,8 @@ id = '[A-Za-z_][A-Za-z0-9_]*' # match identifier
 blank_line = re.compile('^[ \t]*($|#)')
 is_class = re.compile('^class[ \t]+(?P<id>'+id+')[ \t]*(?P<sup>\([^)]*\))?[ \t]*:')
 is_method = re.compile('^[ \t]+def[ \t]+(?P<id>'+id+')[ \t]*\(')
-is_import = re.compile('^import[ \t]*(?P<imp>[^#]+)')
-is_from = re.compile('^from[ \t]+(?P<module>'+id+'([ \t]*\\.[ \t]*'+id+')*)[ \t]+import[ \t]+(?P<imp>[^#]+)')
+is_import = re.compile('^import[ \t]*(?P<imp>[^#;]+)')
+is_from = re.compile('^from[ \t]+(?P<module>'+id+'([ \t]*\\.[ \t]*'+id+')*)[ \t]+import[ \t]+(?P<imp>[^#;]+)')
 dedent = re.compile('^[^ \t]')
 indent = re.compile('^[^ \t]*')