@@ -836,13 +836,13 @@ local brace_expand_split = function(s, separator)
836
836
local depth = 0
837
837
while pos <= s :len () do
838
838
local c = s :sub (pos , pos )
839
- if c == ' \\ ' then
839
+ if c == " \\ " then
840
840
pos = pos + 1
841
841
elseif c == separator and depth == 0 then
842
842
return s :sub (1 , pos - 1 ), s :sub (pos + 1 )
843
- elseif c == ' { ' then
843
+ elseif c == " { " then
844
844
depth = depth + 1
845
- elseif c == ' } ' then
845
+ elseif c == " } " then
846
846
if depth > 0 then
847
847
depth = depth - 1
848
848
end
@@ -897,11 +897,11 @@ local brace_expand_contents = function(s)
897
897
898
898
--- Process numeric sequence expression. e.g. {0..2} -> {0,1,2}, {01..05..2} -> {01,03,05}
899
899
local resolve_sequence_num = function (from , to , step )
900
- local format = ' %d '
900
+ local format = " %d "
901
901
-- Pad strings in the presence of a leading zero
902
- local pattern = ' ^-?0%d'
902
+ local pattern = " ^-?0%d"
903
903
if from :match (pattern ) or to :match (pattern ) then
904
- format = ' %0 ' .. math.max (# from , # to ) .. ' d '
904
+ format = " %0 " .. math.max (# from , # to ) .. " d "
905
905
end
906
906
return resolve_sequence (from , to , step , function (i )
907
907
return string.format (format , i )
952
952
--- @param s string : input string. e.g. {a..e..2 } -> { a,c,e }, { 00..05..2 } -> { 00, 03, 05}
953
953
--- @return string[] : result of expansion , array with at least one string (one means it failed to expand and the raw string is returned )
954
954
M .brace_expand = function (s )
955
- local preamble , postamble = brace_expand_split (s , ' { ' )
955
+ local preamble , postamble = brace_expand_split (s , " { " )
956
956
if postamble == nil then
957
957
return { s }
958
958
end
@@ -961,12 +961,12 @@ M.brace_expand = function(s)
961
961
postscript = postamble
962
962
while contents == nil do
963
963
local old_expr = expr
964
- expr , postscript = brace_expand_split (postscript , ' } ' )
964
+ expr , postscript = brace_expand_split (postscript , " } " )
965
965
if old_expr then
966
- expr = old_expr .. ' } ' .. expr
966
+ expr = old_expr .. " } " .. expr
967
967
end
968
968
if postscript == nil then -- No closing brace found, so we put back the unmatched '{'
969
- preamble = preamble .. ' { '
969
+ preamble = preamble .. " { "
970
970
expr , postscript = nil , postamble
971
971
end
972
972
contents = brace_expand_contents (expr )
@@ -983,5 +983,4 @@ M.brace_expand = function(s)
983
983
return result
984
984
end
985
985
986
-
987
986
return M
0 commit comments