summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--interfaces-model.lua11
1 files changed, 6 insertions, 5 deletions
diff --git a/interfaces-model.lua b/interfaces-model.lua
index 8d4a32b..b67b463 100644
--- a/interfaces-model.lua
+++ b/interfaces-model.lua
@@ -182,10 +182,7 @@ iface.unpack_interfaces = function ()
local comment = ""
local auto = {}
- for line in string.gmatch ( iface.file.value, ".-\n") do
- -- strip leading spaces, tabs
- line = string.gsub (line, "^[%s]*", "")
- line = string.gsub (line, "\n*$", "")
+ for line in string.gmatch ( iface.file.value, "%s*([^\n]*%S)%s*\n?") do
-- it can be #, auto, iface, or a parameter
if string.match(line, "^#") then
comment = iface.append(comment, line , "#%s*" )
@@ -193,7 +190,7 @@ iface.unpack_interfaces = function ()
local name = string.match(line, "auto%s+(%w+)")
auto[name] = true
elseif string.match(line, "^iface") then
- local name, family, method = string.match(line, "%w+%s+(%w+)%s+(%w+)%s+(%w+)")
+ local name, family, method = string.match(line, "%w+%s+([%w.]+)%s+(%w+)%s+(%w+)")
array[#array + 1] = iface.iface_type(family, method)
local interface = array[#array].value
interface.comment.value = comment
@@ -206,6 +203,10 @@ iface.unpack_interfaces = function ()
string.match(line, "(%S+)%s*(.*)$")
if (param) then
local interface = array[#array].value
+ if comment ~= "" then
+ interface.comment.value = iface.append(interface.comment.value, comment)
+ comment = ""
+ end
if not (interface[param]) then
interface[param] = cfe({label=param, errtxt = "Unknown parameter"})
end