summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenny Shields <mail@kennyshields.net>2016-07-09 18:54:41 -0400
committerKenny Shields <mail@kennyshields.net>2016-07-09 18:54:41 -0400
commit233a562071dcae02dd93061fe7147390b27e1677 (patch)
tree8634215a9aaf4e0f98c880e33010e2430fa492bd
parent8ecde3a5a3f7e80b8352311b0a302e5dba6be60a (diff)
downloadstp-233a562071dcae02dd93061fe7147390b27e1677.tar.gz
stp-233a562071dcae02dd93061fe7147390b27e1677.zip
Implement functionality for adding/replacing comment patterns via init function config table
-rw-r--r--init.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/init.lua b/init.lua
index e06a7f7..ae7e353 100644
--- a/init.lua
+++ b/init.lua
@@ -148,6 +148,18 @@ end
function lib.init(config)
if config.path then
+ if config.comment_patterns then
+ if config.replace_comment_patterns then
+ comment_patterns = config.comment_patterns
+ else
+ for k, v in pairs(config.comment_patterns.multiline) do
+ comment_patterns.multiline[k] = v
+ end
+ for k, v in ipairs(config.comment_patterns.single) do
+ table.insert(comment_patterns.single, v)
+ end
+ end
+ end
for line in io.lines(config.path) do
parseLine(trim(line))
end