diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-12-14 12:15:50 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-12-14 12:15:50 +0800 |
commit | d01289e9bf88270e593e48f9a454097592be974b (patch) | |
tree | 27aecb00b79ab44e3ad2ba25f1cbb39f99a0fb8b /script/glob/glob.lua | |
parent | 2a7333102a87bb55805ad83f443736545a825aab (diff) | |
download | lua-language-server-d01289e9bf88270e593e48f9a454097592be974b.zip |
fix #291
Diffstat (limited to 'script/glob/glob.lua')
-rw-r--r-- | script/glob/glob.lua | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/script/glob/glob.lua b/script/glob/glob.lua index aa8923f3..59fa83a8 100644 --- a/script/glob/glob.lua +++ b/script/glob/glob.lua @@ -19,7 +19,7 @@ end local parser = m.P { 'Main', ['Sp'] = m.S(' \t')^0, - ['Slash'] = m.S('/\\')^1, + ['Slash'] = m.P('/')^1, ['Main'] = m.Ct(m.V'Sp' * m.P'{' * m.V'Pattern' * (',' * expect(m.V'Pattern', 'Miss exp after ","'))^0 * m.P'}') + m.Ct(m.V'Pattern') + m.T'Main Failed' @@ -35,7 +35,9 @@ local parser = m.P { + object('?', m.P'?') + object('[]', m.V'Range') , - ['Char'] = object('char', (1 - m.S',{}[]*?/\\')^1), + ['SimpleChar'] = m.P(1) - m.S',{}[]*?/', + ['EscChar'] = m.P'\\' / '' * m.P(1), + ['Char'] = object('char', m.Cs((m.V'EscChar' + m.V'SimpleChar')^1)), ['FSymbol'] = object('**', m.P'**'), ['RangeWord'] = 1 - m.P']', ['Range'] = m.P'[' * m.Ct(m.V'RangeUnit'^0) * m.P']'^-1, @@ -83,6 +85,7 @@ function mt:__call(path) if self.options.ignoreCase then path = path:lower() end + path = path:gsub('^[/\\]+', '') for _, refused in ipairs(self.refused) do if refused(path) then return false |