MCPcopy
hub / github.com/xavierd/clang_complete / reparse

Method reparse

plugin/clang/cindex.py:880–905  ·  view source on GitHub ↗

Reparse an already parsed translation unit. In-memory contents for files can be provided by passing a list of pairs as unsaved_files, the first items should be the filenames to be mapped and the second should be the contents to be substituted for the file. T

(self, unsaved_files = [], options = Nothing)

Source from the content-addressed store, hash-verified

878 return DiagIterator(self)
879
880 def reparse(self, unsaved_files = [], options = Nothing):
881 """
882 Reparse an already parsed translation unit.
883
884 In-memory contents for files can be provided by passing a list of pairs
885 as unsaved_files, the first items should be the filenames to be mapped
886 and the second should be the contents to be substituted for the
887 file. The contents may be passed as strings or file objects.
888 """
889 unsaved_files_array = 0
890 if len(unsaved_files):
891 unsaved_files_array = (_CXUnsavedFile * len(unsaved_files))()
892 for i,(name,value) in enumerate(unsaved_files):
893 if not isinstance(value, str):
894 # FIXME: It would be great to support an efficient version
895 # of this, one day.
896 value = value.read()
897 print value
898 if not isinstance(value, str):
899 raise TypeError,'Unexpected unsaved file contents.'
900 unsaved_files_array[i].name = name
901 unsaved_files_array[i].contents = value
902 unsaved_files_array[i].length = len(value)
903 ptr = TranslationUnit_reparse(self, len(unsaved_files),
904 unsaved_files_array,
905 options)
906 def codeComplete(self, path, line, column, unsaved_files = [], options = 0):
907 """
908 Code complete in this translation unit.

Callers 1

Calls 1

readMethod · 0.80

Tested by

no test coverage detected