You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/for-contributors/Generator/name-processing.md
+31-2Lines changed: 31 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -90,6 +90,37 @@ var nameProcessors = new INameProcessor[]
90
90
91
91
For specifics on how these processors and other steps work, it is best to refer to the `PrettifyNames` source code.
92
92
93
+
## PrettifyNames - Notable Decisions
94
+
95
+
Note: It may be helpful to come back to this section after reading about the rest of the name processing pipeline.
96
+
97
+
### Strip/Reapply Affixes Scope
98
+
99
+
Affixes are stripped and reapplied to create a "scope" where only the base name is visible.
100
+
101
+
For example, in the execution order above, `PrettifyProcessor` only affects the base name, but
102
+
`PrefixIfStartsWithNumberProcessor` works on the full name with affixes applied.
103
+
104
+
Currently, this distinction is not as prevalent as it was when shared prefix trimming was done during `PrettifyNames`.
105
+
106
+
Originally, this was implemented so that prefix identification ignores any affixes that have been declared. This
107
+
notably affects cases like the `I-` prefix in the Microsoft bindings (the C-style namespace prefix is after the `I-`)
108
+
and the vendor suffixes in the Khronos bindings (removing the suffixes before identifying shared prefixes prevents
109
+
problematic cases where prefix trimming trims everything except for the vendor suffix, since the vendor suffix was the
110
+
only non-shared part of the name; see `OcclusionQueryParameterNameNV` in OpenGL for example).
111
+
112
+
Shared prefix identification is now handled by `IdentifySharedPrefixes` by handling affix stripping/reapplication using
113
+
the utility methods provided by `NameAffixer`. `PrettifyNames` can be then configured to remove these shared prefixes,
114
+
thus matching the original behavior.
115
+
116
+
### Strip/Reapply Affixes Configuration
117
+
118
+
To keep things simple, only affix reapplication is configurable. This is because the user is expected to configure the
119
+
generator output, while mods are expected to handle the process of affix identification.
120
+
121
+
Affix reapplication is when common transformations to affixes are applied, such as removing them, reordering them, and
122
+
prettifying them.
123
+
93
124
## Name Splitting
94
125
95
126
Name splitting involves splitting an identifier into separate "tokens" and is handled by the `NameSplitter` class. These
@@ -234,8 +265,6 @@ Furthermore, because each category of affix can be identified by different mods,
234
265
identification process localized to the mod that specializes in that area. For example, C-style namespace prefixes
235
266
are handled by `IdentifySharedPrefixes`.
236
267
237
-
(TODO: Explain the motivation behind this system. Explain that users configure how name affixes are processed while mods identify affixes (separation of concerns).)
238
-
239
268
### Referenced Affixes
240
269
241
270
(TODO: Explain why referenced affixes exist (compound names and types that are the logical extensions of other types) and when these are used in the generator. Explain how these are processed.)
0 commit comments