Skip to content

Commit

Permalink
ditto - got reorg to work!
Browse files Browse the repository at this point in the history
  • Loading branch information
hansonchar committed Jun 18, 2024
1 parent 0a64fe1 commit cffef3d
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions doc/generic/pgf/lib/examplesfinder.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,26 @@ local I =

local finder = {}

local function reorg(t, k, v)
-- local tostring = require "ml".tstring

local function reorg(table, k, v, ...)
if type(k) == "string" then
u.set(t, k, v)
u.set(table, k, u.strip(v))
end
for i, t in ipairs(...) do
-- print("Argument " .. i .. ": " .. tostring(t))
table[i] = t
end
return t
return table
end

-- Grammar to extract code from function call to "example" with a table parameter
finder.grammar =
P {
"examples",
examples = SP * "examples" * SP * "=" * SP * "{" * SP * V "content" * SP * "}",
-- content = Cf(Ct"" * Cg(V("options") ^ -1 * Ct(V("exentry") ^ 1)), reorg),
content = Ct(V("options") ^ -1 * V("exentry") ^ 1),
content = Cf(Ct"" * Cg(V("options") ^ -1 * Ct(V("exentry") ^ 1)), reorg),
-- content = Ct(V("options") ^ -1 * V("exentry") ^ 1),
options = V "optionskv" * P(",") ^ -1,
optionskv = Cg(C("options") * SP * "=" * SP * str),
exentry = SP * "{" * SP * V "excontent" * SP * "}" * P(",") ^ -1,
Expand Down

0 comments on commit cffef3d

Please sign in to comment.