eric6/Utilities/ModuleParser.py

changeset 8131
f2129bb79269
parent 8099
522946e53835
child 8142
43248bafe9b2
child 8205
4a0f1f896341
equal deleted inserted replaced
8130:5fe4ff181b68 8131:f2129bb79269
35 SUPPORTED_TYPES = [PY_SOURCE, PTL_SOURCE, RB_SOURCE] 35 SUPPORTED_TYPES = [PY_SOURCE, PTL_SOURCE, RB_SOURCE]
36 TYPE_MAPPING = { 36 TYPE_MAPPING = {
37 "Python": PY_SOURCE, 37 "Python": PY_SOURCE,
38 "Python3": PY_SOURCE, 38 "Python3": PY_SOURCE,
39 "MicroPython": PY_SOURCE, 39 "MicroPython": PY_SOURCE,
40 "Cython": PY_SOURCE,
40 "Ruby": RB_SOURCE, 41 "Ruby": RB_SOURCE,
41 } 42 }
42 43
43 44
44 def getTypeFromTypeName(name): 45 def getTypeFromTypeName(name):
132 (?P<MethodPyQtSignature> [^)]* ) 133 (?P<MethodPyQtSignature> [^)]* )
133 \) \s* 134 \) \s*
134 )? 135 )?
135 ^ 136 ^
136 (?P<MethodIndent> [ \t]* ) 137 (?P<MethodIndent> [ \t]* )
137 (?: async [ \t]+ )? def [ \t]+ 138 (?: async [ \t]+ )? (?: cdef | cpdef | def) [ \t]+
138 (?P<MethodName> \w+ ) 139 (?P<MethodName> \w+ )
139 (?: [ \t]* \[ (?: plain | html ) \] )? 140 (?: [ \t]* \[ (?: plain | html ) \] )?
140 [ \t]* \( 141 [ \t]* \(
141 (?P<MethodSignature> (?: [^)] | \)[ \t]*,? )*? ) 142 (?P<MethodSignature> (?: [^)] | \)[ \t]*,? )*? )
142 \) [ \t]* 143 \) [ \t]*
145 ) 146 )
146 147
147 | (?P<Class> 148 | (?P<Class>
148 ^ 149 ^
149 (?P<ClassIndent> [ \t]* ) 150 (?P<ClassIndent> [ \t]* )
151 (?: cdef [ \t]+ )?
150 class [ \t]+ 152 class [ \t]+
151 (?P<ClassName> \w+ ) 153 (?P<ClassName> \w+ )
152 [ \t]* 154 [ \t]*
153 (?P<ClassSupers> \( [^)]* \) )? 155 (?P<ClassSupers> \( [^)]* \) )?
154 [ \t]* : 156 [ \t]* :
173 ^ 175 ^
174 if \s+ __name__ \s* == \s* [^:]+ : $ 176 if \s+ __name__ \s* == \s* [^:]+ : $
175 ) 177 )
176 178
177 | (?P<Import> 179 | (?P<Import>
178 ^ [ \t]* (?: import | from [ \t]+ \. [ \t]+ import ) [ \t]+ 180 ^ [ \t]* (?: c? import | from [ \t]+ \. [ \t]+ c? import ) [ \t]+
179 (?P<ImportList> (?: [^#;\\\n]* (?: \\\n )* )* ) 181 (?P<ImportList> (?: [^#;\\\n]* (?: \\\n )* )* )
180 ) 182 )
181 183
182 | (?P<ImportFrom> 184 | (?P<ImportFrom>
183 ^ [ \t]* from [ \t]+ 185 ^ [ \t]* from [ \t]+
186 (?: 188 (?:
187 [ \t]* \. [ \t]* \w+ 189 [ \t]* \. [ \t]* \w+
188 )* 190 )*
189 ) 191 )
190 [ \t]+ 192 [ \t]+
191 import [ \t]+ 193 c? import [ \t]+
192 (?P<ImportFromList> 194 (?P<ImportFromList>
193 (?: \( \s* .*? \s* \) ) 195 (?: \( \s* .*? \s* \) )
194 | 196 |
195 (?: [^#;\\\n]* (?: \\\n )* )* ) 197 (?: [^#;\\\n]* (?: \\\n )* )* )
196 ) 198 )

eric ide

mercurial