Utilities/ModuleParser.py

branch
Py2 comp.
changeset 3058
0a02c433f52d
parent 3057
10516539f238
parent 3030
4a0a82ddd9d2
child 3060
5883ce99ee12
equal deleted inserted replaced
3057:10516539f238 3058:0a02c433f52d
56 return TYPE_MAPPING[name] 56 return TYPE_MAPPING[name]
57 else: 57 else:
58 return -1 58 return -1
59 59
60 60
61 _py_getnext = re.compile(r""" 61 _py_getnext = re.compile(
62 r"""
62 (?P<String> 63 (?P<String>
63 \""" (?P<StringContents1> 64 \""" (?P<StringContents1>
64 [^"\\]* (?: 65 [^"\\]* (?:
65 (?: \\. | "(?!"") ) 66 (?: \\. | "(?!"") )
66 [^"\\]* 67 [^"\\]*
189 (?P<ConditionalDefineIndent> [ \t]* ) 190 (?P<ConditionalDefineIndent> [ \t]* )
190 (?: (?: if | elif ) [ \t]+ [^:]* | else [ \t]* ) : (?= \s* def) 191 (?: (?: if | elif ) [ \t]+ [^:]* | else [ \t]* ) : (?= \s* def)
191 ) 192 )
192 """, re.VERBOSE | re.DOTALL | re.MULTILINE).search 193 """, re.VERBOSE | re.DOTALL | re.MULTILINE).search
193 194
194 _rb_getnext = re.compile(r""" 195 _rb_getnext = re.compile(
196 r"""
195 (?P<Docstring> 197 (?P<Docstring>
196 =begin [ \t]+ edoc (?P<DocstringContents> .*? ) =end 198 =begin [ \t]+ edoc (?P<DocstringContents> .*? ) =end
197 ) 199 )
198 200
199 | (?P<String> 201 | (?P<String>
959 classstack[-1][0].setEndLine(lineno - 1) 961 classstack[-1][0].setEndLine(lineno - 1)
960 del classstack[-1] 962 del classstack[-1]
961 module_name = m.group("ModuleName") 963 module_name = m.group("ModuleName")
962 # remember this class 964 # remember this class
963 cur_class = RbModule(self.name, module_name, 965 cur_class = RbModule(self.name, module_name,
964 self.file, lineno) 966 self.file, lineno)
965 # add nested Ruby modules to the file 967 # add nested Ruby modules to the file
966 if module_name in self.modules: 968 if module_name in self.modules:
967 cur_class = self.modules[module_name] 969 cur_class = self.modules[module_name]
968 else: 970 else:
969 self.addModule(module_name, cur_class) 971 self.addModule(module_name, cur_class)
1152 exhausted = path + [cls] 1154 exhausted = path + [cls]
1153 exhausted.reverse() 1155 exhausted.reverse()
1154 self.addPathToHierarchy( 1156 self.addPathToHierarchy(
1155 exhausted, result, self.addPathToHierarchy) 1157 exhausted, result, self.addPathToHierarchy)
1156 else: 1158 else:
1157 rv[cls] = self.assembleHierarchy(cls, 1159 rv[cls] = self.assembleHierarchy(
1158 classes, path + [cls], result) 1160 cls, classes, path + [cls], result)
1159 1161
1160 if len(rv) == 0: 1162 if len(rv) == 0:
1161 exhausted = path 1163 exhausted = path
1162 exhausted.reverse() 1164 exhausted.reverse()
1163 self.addPathToHierarchy(exhausted, result, self.addPathToHierarchy) 1165 self.addPathToHierarchy(exhausted, result, self.addPathToHierarchy)

eric ide

mercurial