MCPcopy Create free account
hub / github.com/git/git / parse

Method parse

t/unit-tests/clar/generate.py:97–121  ·  view source on GitHub ↗
(self, contents)

Source from the content-addressed store, hash-verified

95 return re.sub(SKIP_COMMENTS_REGEX, _replacer, text)
96
97 def parse(self, contents):
98 TEST_FUNC_REGEX = r"^(void\s+(test_%s__(\w+))\s*\(\s*void\s*\))\s*\{"
99
100 contents = self._skip_comments(contents)
101 regex = re.compile(TEST_FUNC_REGEX % self.name, re.MULTILINE)
102
103 self.callbacks = []
104 self.initializers = []
105 self.cleanup = None
106
107 for (declaration, symbol, short_name) in regex.findall(contents):
108 data = {
109 "short_name" : short_name,
110 "declaration" : declaration,
111 "symbol" : symbol
112 }
113
114 if short_name.startswith('initialize'):
115 self.initializers.append(data)
116 elif short_name == 'cleanup':
117 self.cleanup = data
118 else:
119 self.callbacks.append(data)
120
121 return self.callbacks != []
122
123 def refresh(self, path):
124 self.modified = False

Callers 2

refreshMethod · 0.95
parseRFC2822DateFunction · 0.80

Calls 2

_skip_commentsMethod · 0.95
appendMethod · 0.80

Tested by

no test coverage detected