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

Improve function decorator parsing

This commit is contained in:
Étienne Fildadut 2021-11-28 16:23:44 +01:00
parent f2e74c94c9
commit 38b2a6ae69
7 changed files with 57 additions and 104 deletions

View file

@ -326,9 +326,9 @@ local function transform_indented(indented)
table.remove(indented, i)
else
-- function decorator
if l.content:match("^.-[^\\]%$[^#~$]-$") then -- FIXME
if l.content:match("^.-[^\\]%$"..identifier_pattern.."$") then
local name
l.content, name = l.content:match("^(..-)%$([^#~$]-)$")
l.content, name = l.content:match("^(.-[^\\])%$("..identifier_pattern..")$")
indented[i] = { content = "~"..name, source = l.source }
table.insert(indented, i+1, { content = "$"..name, source = l.source, children = { l } })
i = i + 1 -- $ line should not contain any decorator anymore