.metal was absent from EXTENSION_MAP, so Metal Shading Language files were silently skipped. MSL ≈ C++14, and the C++ grammar extracts its functions, structs, type aliases, and call edges at parity with plain C++ — except MSL's post-declarator [[attribute]] annotations, which misparse struct fields into spurious extends refs from the struct to the field's own type (a wrong inheritance edge whenever the repo typedefs float3/float4x4 itself, common in shared ShaderTypes.h). blankMetalAttributes blanks them pre-parse, offset-preserving, following the blankCppExportMacros pattern (#1061), gated to .metal files only — in regular C++ the attribute position is legal syntax the grammar parses natively. The preParse hook gains an optional filePath param to support the gate. Validated on llama.cpp's ggml-metal.metal (10.7k lines: 130 kernels vs 113 `kernel void` ground-truth lines, rope_yarn resolves its 4 kernel callers) and SDL's shaders (PQtoLinear ← GetOutputColor), 0 bogus extends edges. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
35611b92bb
commit
cc89146454
@@ -85,8 +85,10 @@ export interface LanguageExtractor {
|
||||
* grammar mis-parses inside enum bodies). MUST preserve byte offsets (replace
|
||||
* removed text with spaces, keep newlines) so node positions and getNodeText
|
||||
* stay correct; the returned string is used for both parsing and extraction.
|
||||
* `filePath` lets a transform key off the concrete file extension when one
|
||||
* language id serves several dialects (C++ also parses `.metal` shaders).
|
||||
*/
|
||||
preParse?: (source: string) => string;
|
||||
preParse?: (source: string, filePath?: string) => string;
|
||||
|
||||
// --- Node type mappings ---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user