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:
parent
6488bef75c
commit
b9c6d1d704
10 changed files with 84 additions and 21 deletions
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue