Python pygccxml.declarations.calldef.calldef_t() Examples
The following are 1
code examples of pygccxml.declarations.calldef.calldef_t().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
pygccxml.declarations.calldef
, or try the search function
.
Example #1
Source File: gccxmlparser.py From royal-chaos with MIT License | 4 votes |
def get_annotations(self, decl): """ :param decl: pygccxml declaration_t object """ assert isinstance(decl, declaration_t) if isinstance(decl, calldef.calldef_t) \ and decl.is_artificial: #print >> sys.stderr, "********** ARTIFICIAL:", decl return {}, {} file_name = decl.location.file_name line_number = decl.location.line try: lines = self.files[file_name] except KeyError: with open(file_name, "rt") as f: lines = f.readlines() self.files[file_name] = lines line_number -= 2 global_annotations = {} parameter_annotations = {} while 1: line = lines[line_number] line_number -= 1 m = self._comment_rx.match(line) if m is None: break s = m.group('annotation1') if s is None: s = m.group('annotation2') line = s.strip() self._declare_used_annotation(file_name, line_number + 2) for annotation_str in line.split(';'): annotation_str = annotation_str.strip() m = self._global_annotation_rx.match(annotation_str) if m is not None: global_annotations[m.group(1)] = m.group(2) continue m = self._param_annotation_rx.match(annotation_str) if m is not None: param_annotation = {} parameter_annotations[m.group(1)] = param_annotation for param in m.group(2).split(','): m = self._global_annotation_rx.match(param.strip()) if m is not None: param_annotation[m.group(1)] = m.group(2) else: warnings.warn_explicit("could not parse %r as parameter annotation element" % (param.strip()), AnnotationsWarning, file_name, line_number) continue warnings.warn_explicit("could not parse %r" % (annotation_str), AnnotationsWarning, file_name, line_number) return global_annotations, parameter_annotations