feat: add grep_engine_calls (S2 Phase 1)

Greps engine.<namespace>.<func> patterns from Lua source via Lua-pattern.
Returns unique sorted array per spec section 4.2.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Axel Meyer
2026-05-16 13:27:55 +02:00
parent 0457d5c798
commit 24bd00ad9c

View File

@@ -61,4 +61,17 @@ function M.diff_surface(surface, readme)
return { missing_docs = missing, stale_docs = stale }
end
-- Extracts unique engine.<namespace>.<func> calls from Lua source.
-- Returns: array of unique strings, sorted.
function M.grep_engine_calls(source_string)
local seen = {}
for call in string.gmatch(source_string, "(engine%.[_%w]+%.[_%w]+)") do
seen[call] = true
end
local out = {}
for call in pairs(seen) do table.insert(out, call) end
table.sort(out)
return out
end
return M