1
0
Fork 0
mirror of https://github.com/Reuh/anselme.git synced 2025-10-27 16:49:31 +00:00

Decorator system simplification, removed paragraph decorators, added function decorators

This commit is contained in:
Étienne Fildadut 2021-04-23 17:13:39 +02:00
parent 6f564ea0e2
commit 0171d92352
16 changed files with 265 additions and 290 deletions

View file

@ -6,27 +6,6 @@ local parse_text
local function parse(state)
for _, l in ipairs(state.queued_lines) do
local line, namespace = l.line, l.namespace
-- decorators
if line.condition then
if line.condition:match("[^%s]") then
local exp, rem = expression(line.condition, state, namespace)
if not exp then return nil, ("%s; at %s"):format(rem, line.source) end
if rem:match("[^%s]") then return nil, ("expected end of expression before %q in condition decorator; at %s"):format(rem, line.source) end
line.condition = exp
else
line.condition = nil
end
end
if line.tag then
if line.tag:match("[^%s]") then
local exp, rem = expression(line.tag, state, namespace)
if not exp then return nil, ("%s; at %s"):format(rem, line.source) end
if rem:match("[^%s]") then return nil, ("expected end of expression before %q in condition decorator; at %s"):format(rem, line.source) end
line.tag = exp
else
line.tag = nil
end
end
-- expressions
if line.expression then
local exp, rem = expression(line.expression, state, namespace)