Utilities/ClassBrowsers/pyclbr.py

changeset 4465
2fbb5bdb8ddf
parent 4461
3634459f8011
child 4631
5c1a96925da4
equal deleted inserted replaced
4463:87cd9719dc23 4465:2fbb5bdb8ddf
26 26
27 TABWIDTH = 4 27 TABWIDTH = 4
28 28
29 SUPPORTED_TYPES = [ClassBrowsers.PY_SOURCE, ClassBrowsers.PTL_SOURCE] 29 SUPPORTED_TYPES = [ClassBrowsers.PY_SOURCE, ClassBrowsers.PTL_SOURCE]
30 30
31 # TODO: Add support for the new Python 3.5 async def
32 _getnext = re.compile( 31 _getnext = re.compile(
33 r""" 32 r"""
34 (?P<String> 33 (?P<String>
35 \""" [^"\\]* (?: 34 \""" [^"\\]* (?:
36 (?: \\. | "(?!"") ) 35 (?: \\. | "(?!"") )
63 ) 62 )
64 63
65 | (?P<Method> 64 | (?P<Method>
66 ^ 65 ^
67 (?P<MethodIndent> [ \t]* ) 66 (?P<MethodIndent> [ \t]* )
68 def [ \t]+ 67 (?: async [ \t]+ )? def [ \t]+
69 (?P<MethodName> \w+ ) 68 (?P<MethodName> \w+ )
70 (?: [ \t]* \[ (?: plain | html ) \] )? 69 (?: [ \t]* \[ (?: plain | html ) \] )?
71 [ \t]* \( 70 [ \t]* \(
72 (?P<MethodSignature> (?: [^)] | \)[ \t]*,? )*? ) 71 (?P<MethodSignature> (?: [^)] | \)[ \t]*,? )*? )
73 \) [ \t]* 72 \) [ \t]*
101 ) 100 )
102 101
103 | (?P<ConditionalDefine> 102 | (?P<ConditionalDefine>
104 ^ 103 ^
105 (?P<ConditionalDefineIndent> [ \t]* ) 104 (?P<ConditionalDefineIndent> [ \t]* )
106 (?: (?: if | elif ) [ \t]+ [^:]* | else [ \t]* ) : (?= \s* def) 105 (?: (?: if | elif ) [ \t]+ [^:]* | else [ \t]* ) :
106 (?= \s* (?: async [ \t]+ )? def)
107 ) 107 )
108 108
109 | (?P<Import> 109 | (?P<Import>
110 ^ [ \t]* (?: import | from [ \t]+ \. [ \t]+ import ) [ \t]+ 110 ^ [ \t]* (?: import | from [ \t]+ \. [ \t]+ import ) [ \t]+
111 (?P<ImportList> (?: [^#;\\\n]* (?: \\\n )* )* ) 111 (?P<ImportList> (?: [^#;\\\n]* (?: \\\n )* )* )

eric ide

mercurial