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

Add nil expression and fix return behavior with nil expression

This commit is contained in:
Étienne Fildadut 2021-04-12 01:10:42 +02:00
parent 6488bef75c
commit b9c6d1d704
10 changed files with 84 additions and 21 deletions

View file

@ -303,12 +303,22 @@ local function parse_line(line, state, namespace)
elseif l:match("^%#") then
r.type = "tag"
r.child = true
r.expression = l:match("^%#(.*)$")
local expr = l:match("^%#(.*)$")
if expr:match("[^%s]") then
r.expression = expr
else
r.expression = nil
end
-- return
elseif l:match("^%@") then
r.type = "return"
r.parent_function = true
r.expression = l:match("^%@(.*)$")
local expr = l:match("^%@(.*)$")
if expr:match("[^%s]") then
r.expression = expr
else
r.expression = "()"
end
-- text
elseif l:match("[^%s]") then
r.type = "text"