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:
13
init.lua
13
init.lua
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user