diff options
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/lexers/bash.lua | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lua/lexers/bash.lua b/lua/lexers/bash.lua index 4dc4cf6..7927b4a 100644 --- a/lua/lexers/bash.lua +++ b/lua/lexers/bash.lua @@ -20,15 +20,15 @@ local ex_str = l.delimited_range('`') local heredoc = '<<' * P(function(input, index) local s, e, minus, _, delimiter = input:find('(-?)(["\']?)([%a_][%w_]*)%2[\n\r\f;]+', index) - -- If the starting delimiter of a here-doc begins with "-", then - -- spaces are allowed to come before the closing delimiter. - local close_pattern - if minus == '-' then - close_pattern = '[\n\r\f%s]+'..delimiter..'\n' - else - close_pattern = '[\n\r\f]+'..delimiter..'\n' - end if s == index and delimiter then + -- If the starting delimiter of a here-doc begins with "-", then + -- spaces are allowed to come before the closing delimiter. + local close_pattern + if minus == '-' then + close_pattern = '[\n\r\f%s]+'..delimiter..'\n' + else + close_pattern = '[\n\r\f]+'..delimiter..'\n' + end local _, e = input:find(close_pattern, e) return e and e + 1 or #input + 1 end |
