diff --git a/doc/generic/pgf/lib/examplefinder.lua b/doc/generic/pgf/lib/examplefinder.lua index 84a504b1a..22497ac90 100644 --- a/doc/generic/pgf/lib/examplefinder.lua +++ b/doc/generic/pgf/lib/examplefinder.lua @@ -1,10 +1,10 @@ local lpeg = require("lpeg") local C, Ct, P, V = lpeg.C, lpeg.Ct, lpeg.P, lpeg.V -local t = {} +local finder = {} -- Grammar to extract code from function call to "example" with a string parameter -t.grammar = +finder.grammar = P { "example", begincodeexample = P "\n" ^ -1 * "example\n[[", @@ -15,16 +15,16 @@ t.grammar = example = V "anything" * Ct(V "codeexample" * (V "anything" * V "codeexample") ^ 0) * V "anything" } -function t.get_options(_) +function finder.get_options(_) return {} end -function t.get_content(e) +function finder.get_content(e) return e[1] end -function t.get_name() +function finder.get_name() return "example" end -return t +return finder diff --git a/doc/generic/pgf/lib/stringmatcher.lua b/doc/generic/pgf/lib/stringmatcher.lua index 7453407e7..7616a6fc6 100644 --- a/doc/generic/pgf/lib/stringmatcher.lua +++ b/doc/generic/pgf/lib/stringmatcher.lua @@ -7,7 +7,7 @@ local SP = loc.space ^ 0 -- spaces -- Used to match a string which can be single-quoted, double-quoted or multi-line -- surrounded by inside double square brackets. -local string_matcher = +local matcher = P { "str", single_quoted = SP * "'" * C(((1 - P "'") + "\\'") ^ 0) * "'", @@ -17,7 +17,7 @@ local string_matcher = } if not UNIT_TESTING then - return string_matcher + return matcher end -- Unit tests and debugging @@ -74,7 +74,7 @@ local test_strings = { for _, s in ipairs(test_strings) do -- local match = lpeg.match(general_str, s) -- local match = general_str:match(s) - local match = string_matcher:match(s) + local match = matcher:match(s) if match then print("Match found: " .. match) else