Utilities/ModuleParser.py

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

eric ide

mercurial