Kaydet (Commit) e73d7023 authored tarafından Guido van Rossum's avatar Guido van Rossum

Ever-so-slight improvementL the patterns to recognize import

statements now also stop at ';' (formerly they only stopped at '#').
üst 7d447aab
...@@ -42,8 +42,8 @@ id = '[A-Za-z_][A-Za-z0-9_]*' # match identifier ...@@ -42,8 +42,8 @@ id = '[A-Za-z_][A-Za-z0-9_]*' # match identifier
blank_line = re.compile('^[ \t]*($|#)') blank_line = re.compile('^[ \t]*($|#)')
is_class = re.compile('^class[ \t]+(?P<id>'+id+')[ \t]*(?P<sup>\([^)]*\))?[ \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_method = re.compile('^[ \t]+def[ \t]+(?P<id>'+id+')[ \t]*\(')
is_import = re.compile('^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>[^#]+)') is_from = re.compile('^from[ \t]+(?P<module>'+id+'([ \t]*\\.[ \t]*'+id+')*)[ \t]+import[ \t]+(?P<imp>[^#;]+)')
dedent = re.compile('^[^ \t]') dedent = re.compile('^[^ \t]')
indent = re.compile('^[^ \t]*') indent = re.compile('^[^ \t]*')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment