Diff options
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Drop fallbacks for a match that cannot fail
A table capture of a pattern repeated zero or more times matches every string, the empty one included, so the inline grammars never return nil.
Diffstat (limited to '')
-rw-r--r--custom/extensions/about-render.lua6
1 file changed, 3 insertions, 3 deletions
diff --git a/custom/extensions/about-render.lua b/custom/extensions/about-render.lua
index 9474225..b6ea560 100644
--- a/custom/extensions/about-render.lua
+++ b/custom/extensions/about-render.lua
@@ -442,7 +442,7 @@ if has_lpeg then
return { node_text(s) }
end
inline_depth = inline_depth + 1
- local nodes = inline_grammar:match(s) or { node_text(s) }
+ local nodes = inline_grammar:match(s)
inline_depth = inline_depth - 1
return nodes
end
@@ -762,7 +762,7 @@ if has_lpeg then
) ^ 0)
local function man_inline(text)
- local tokens = man_inline_grammar:match(text) or {}
+ local tokens = man_inline_grammar:match(text)
local nodes, parts, font = {}, {}, "R"
local function flush()
if #parts == 0 then
@@ -803,7 +803,7 @@ if has_lpeg then
-- each one is wanted there, without its fonts.
local function man_plain(text)
local parts = {}
- for _, token in ipairs(man_inline_grammar:match(text) or {}) do
+ for _, token in ipairs(man_inline_grammar:match(text)) do
if token.kind == "text" then
parts[#parts + 1] = token.text
end