Build type groups from standard library TypeDefs. Derives colorN, vectorN, matrixNN groups from type naming patterns.
(stdlib)
| 31 | return {td.getName() for td in stdlib.getTypeDefs()} |
| 32 | |
| 33 | def buildTypeGroups(stdlib): |
| 34 | ''' |
| 35 | Build type groups from standard library TypeDefs. |
| 36 | Derives colorN, vectorN, matrixNN groups from type naming patterns. |
| 37 | ''' |
| 38 | groups = {} |
| 39 | for td in stdlib.getTypeDefs(): |
| 40 | name = td.getName() |
| 41 | # Match colorN, vectorN patterns (color3, vector2, etc.) |
| 42 | match = re.match(r'^(color|vector)(\d)$', name) |
| 43 | if match: |
| 44 | groupName = f'{match.group(1)}N' |
| 45 | groups.setdefault(groupName, set()).add(name) |
| 46 | continue |
| 47 | # Match matrixNN pattern (matrix33, matrix44) |
| 48 | match = re.match(r'^matrix(\d)\1$', name) |
| 49 | if match: |
| 50 | groups.setdefault('matrixNN', set()).add(name) |
| 51 | return groups |
| 52 | |
| 53 | def buildTypeGroupVariables(typeGroups): |
| 54 | '''Build type group variables (e.g., colorM from colorN) for "must differ" constraints.''' |
no test coverage detected