fix: tighten keyword detection to avoid preamble false positives
Problem: the 2-space inline keyword pattern matched preamble lines like "The possible keywords" where "The" was detected as a keyword. Solution: require an uppercase letter after the 2 spaces, matching real inline definitions (Tunnel Request, SetEnv Directly) but not preamble text where the next word is lowercase.
This commit is contained in:
parent
e9bb8de70f
commit
a145b2648a
1 changed files with 6 additions and 2 deletions
|
|
@ -52,7 +52,9 @@ local function extract_enums_from_man(man_stdout)
|
|||
|
||||
local defs = {}
|
||||
for i, line in ipairs(lines) do
|
||||
local kw = line:match('^ (%u[%a%d]+)%s*$') or line:match('^ (%u[%a%d]+) ')
|
||||
local kw = line:match('^ (%u[%a%d]+)%s*$')
|
||||
or line:match('^ (%u[%a%d]+) ')
|
||||
or line:match('^ (%u[%a%d]+) %u')
|
||||
if kw then
|
||||
defs[#defs + 1] = { line = i, keyword = kw }
|
||||
end
|
||||
|
|
@ -163,7 +165,9 @@ local function parse_keywords(stdout)
|
|||
|
||||
local defs = {}
|
||||
for i, line in ipairs(lines) do
|
||||
local kw = line:match('^ (%u[%a%d]+)%s*$') or line:match('^ (%u[%a%d]+) ')
|
||||
local kw = line:match('^ (%u[%a%d]+)%s*$')
|
||||
or line:match('^ (%u[%a%d]+) ')
|
||||
or line:match('^ (%u[%a%d]+) %u')
|
||||
if kw then
|
||||
local inline = line:match('^ %u[%a%d]+%s%s+(.+)')
|
||||
defs[#defs + 1] = { line = i, keyword = kw, inline = inline }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue