Skip to content

Commit fd355c9

Browse files
committed
chore: improve comments on how anyQuote ignores escaped quotes
1 parent b3910e6 commit fd355c9

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

lua/various-textobjs/textobjs/charwise.lua

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,13 @@ end
3131

3232
---@param scope "inner"|"outer"
3333
function M.anyQuote(scope)
34-
-- INFO `%f[\"]` is the lua frontier pattern, and effectively used as a negative
35-
-- lookbehind, that is ensuring that the previous character may not be a `\`.
34+
-- INFO
35+
-- `(").-(")` would be enough if we were just to check for any quote character.
36+
--
37+
-- To handle escaped quotes, we use make use of frontier patterns and handle
38+
-- various edge cases. `%f[\"]` is the lua frontier pattern, and effectively
39+
-- used as a negative lookbehind, that is ensuring that the previous
40+
-- character may not be a `\`.
3641
local patterns = {
3742
['"'] = [[(%f[\"]").-(%f[\"]")]],
3843
["'"] = [[(%f[\']').-(%f[\']')]],

0 commit comments

Comments
 (0)