The Parser

This commit is contained in:
Kistaro Windrider 2023-10-03 22:41:52 -07:00
parent a5ce0fd020
commit fd9866e963
Signed by: kistaro
SSH Key Fingerprint: SHA256:TBE2ynfmJqsAf0CP6gsflA0q5X5wD5fVKWPsZ7eVUg8

View File

@ -416,6 +416,27 @@ function grab_p1_butts()
}
end
-->8
-- the parser
parser = {}
mknew(parser)
function parser:ingest(str)
for row in all(split(str, "\n")) do
local prev = {}
local sectors = split(row, ":")
for i=1,#sectors,2 do
local x = self[sectors[i]](self, prev, usplit(sectors[i+1]))
if (x) add(prev, x)
end
end
end
function parser:saveas(prev, name, sel)
self[name] = sel and prev[sel] or prev
end
-->8
--ship behavior