MCPcopy Index your code
hub / github.com/KhronosGroup/Vulkan-Docs / addVUID

Method addVUID

scripts/reflow.py:159–276  ·  view source on GitHub ↗
(self, para, state)

Source from the content-addressed store, hash-verified

157 self.visitVUID(vuid, line)
158
159 def addVUID(self, para, state):
160 hangIndent = state.hangIndent
161
162 """Generate and add VUID if necessary."""
163 if not state.isVU or self.nextvu is None:
164 return para, hangIndent
165
166 # If:
167 # - this paragraph is in a Valid Usage block,
168 # - VUID tags are being assigned,
169 # Try to assign VUIDs
170
171 if nestedVuPat.search(para[0]):
172 # Do not assign VUIDs to nested bullet points.
173 # These are now allowed VU markup syntax, but will never
174 # themselves be VUs, just subsidiary points.
175 return para, hangIndent
176
177 # Skip if there is already a VUID assigned
178 if self.vuPrefix in para[0]:
179 return para, hangIndent
180
181 # If:
182 # - a tag is not already present, and
183 # - the paragraph is a properly marked-up list item
184 # Then add a VUID tag starting with the next free ID.
185
186 # Split the first line after the bullet point
187 matches = vuPat.search(para[0])
188 if matches is None:
189 # There are only a few cases of this, and they are all
190 # legitimate. Leave detecting this case to another tool
191 # or hand inspection.
192 # logWarn(self.filename + ': Unexpected non-bullet item in VU block (harmless if following an ifdef):',
193 # para[0])
194 return para, hangIndent
195
196 outPara = para
197
198 logDiag('addVUID: Matched vuPat on line:', para[0], end='')
199 head = matches.group('head')
200 tail = matches.group('tail')
201
202 # Find pname: or code: tags in the paragraph for the purposes of VUID
203 # tag generation. pname:{attribute}s are prioritized to make sure
204 # commonvalidity VUIDs end up being unique. Otherwise, the first pname:
205 # or code: tag in the paragraph is used, which may not always be
206 # correct, but should be highly reliable.
207 pnameMatches = re.findall(pnamePat, ' '.join(para))
208 codeMatches = re.findall(codePat, ' '.join(para))
209
210 # Prioritize {attribute}s, but not the ones in the exception list
211 # below. These have complex expressions including ., ->, or [index]
212 # which makes them unsuitable for VUID tags. Ideally these would be
213 # automatically discovered.
214 attributeExceptionList = ['maxinstancecheck', 'regionsparam',
215 'rayGenShaderBindingTableAddress',
216 'rayGenShaderBindingTableStride',

Callers 1

transformParagraphMethod · 0.95

Calls 4

visitVUIDMethod · 0.95
logDiagFunction · 0.90
logWarnFunction · 0.90
appendMethod · 0.80

Tested by

no test coverage detected