summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lua-script/script.h21
-rw-r--r--src/lua-script/script.lua21
2 files changed, 40 insertions, 2 deletions
diff --git a/src/lua-script/script.h b/src/lua-script/script.h
index e29003f..9406097 100644
--- a/src/lua-script/script.h
+++ b/src/lua-script/script.h
@@ -237,13 +237,32 @@ const char *argent_script =
" return false\n"
" end\n"
"\n"
+ " function should_process(filename, parent)\n"
+ " if not string.match(filename, '%.lua$') then\n"
+ " return false\n"
+ " end\n"
+ " \n"
+ " if should_ignore(filename, parent) then\n"
+ " return false\n"
+ " end\n"
+ "\n"
+ " for pattern in pairs(argent.config.noprocess) do\n"
+ " if string.match(filename, pattern)\n"
+ " or string.match(parent..filename, pattern) then\n"
+ " return false\n"
+ " end\n"
+ " end\n"
+ "\n"
+ " return true\n"
+ " end\n"
+ "\n"
" function process_file(filename, parent)\n"
" if should_ignore(filename, parent) then\n"
" argent.log('debug', fmt('will not process file %q', parent..filename))\n"
" return\n"
" end\n"
"\n"
- " if string.match(filename, '%.lua$') and not argent.config.noprocess[filename] then\n"
+ " if should_process(filename, parent) then\n"
" argent.log('debug', fmt('processing %q as lua file', parent..filename))\n"
" process_lua_file(filename, parent)\n"
" else\n"
diff --git a/src/lua-script/script.lua b/src/lua-script/script.lua
index c6c2ecb..e44ece5 100644
--- a/src/lua-script/script.lua
+++ b/src/lua-script/script.lua
@@ -236,13 +236,32 @@ return function(config)
return false
end
+ function should_process(filename, parent)
+ if not string.match(filename, '%.lua$') then
+ return false
+ end
+
+ if should_ignore(filename, parent) then
+ return false
+ end
+
+ for pattern in pairs(argent.config.noprocess) do
+ if string.match(filename, pattern)
+ or string.match(parent..filename, pattern) then
+ return false
+ end
+ end
+
+ return true
+ end
+
function process_file(filename, parent)
if should_ignore(filename, parent) then
argent.log('debug', fmt('will not process file %q', parent..filename))
return
end
- if string.match(filename, '%.lua$') and not argent.config.noprocess[filename] then
+ if should_process(filename, parent) then
argent.log('debug', fmt('processing %q as lua file', parent..filename))
process_lua_file(filename, parent)
else