@@ -46,24 +46,24 @@ function M.find_files_to_compile(entry_point, pattern)
46
46
end
47
47
48
48
-- Parse the config file and extract variables
49
- --- @param string
49
+ --- @param file_path string
50
50
--- @return table config A table like { { entry_point , ouptput , .. } .. }
51
- function M .parse_config_file (filePath )
52
- local file = assert (io.open (filePath , " r" )) -- Open the file in read mode
51
+ function M .parse_config_file (file_path )
52
+ local file = assert (io.open (file_path , " r" )) -- Open the file in read mode
53
53
local config = {} -- Initialize an empty Lua table to store the variables
54
- local currentEntry = nil -- Variable to track the current entry being processed
54
+ local current_entry = nil -- Variable to track the current entry being processed
55
55
56
56
for line in file :lines () do
57
57
if not (line :match (" ^%s*#" ) or line :match (" ^%s*$" )) then -- ignore comments and empty lines
58
58
local entry = line :match (" %[([^%]]+)%]" ) -- Check if the line represents a new entry
59
59
if entry then
60
- currentEntry = entry -- Update the current entry being processed
61
- config [currentEntry ] = {} -- Initialize a sub-table for the current entry
60
+ current_entry = entry -- Update the current entry being processed
61
+ config [current_entry ] = {} -- Initialize a sub-table for the current entry
62
62
else
63
63
local key , value = line :match (" ([^=]+)%s-=%s-(.+)" ) -- Extract key-value pairs
64
- if key and value and currentEntry then
64
+ if key and value and current_entry then
65
65
value = value :gsub (" ^%s*[\" '](.+)[\" ']%s*$" , " %1" ) -- Remove surrounding quotes if present
66
- config [currentEntry ][vim .trim (key )] = vim .trim (value ) -- Store the variable in the table
66
+ config [current_entry ][vim .trim (key )] = vim .trim (value ) -- Store the variable in the table
67
67
end
68
68
end
69
69
end
0 commit comments