mirror of
https://github.com/Reuh/anselme.git
synced 2025-10-28 00:59:31 +00:00
Add scoped functions
This commit is contained in:
parent
3d32f35d67
commit
fef498b3d7
16 changed files with 1164 additions and 58 deletions
|
|
@ -43,6 +43,16 @@ local function parse(state)
|
|||
end
|
||||
line.assignment.type_annotation = type_exp
|
||||
end
|
||||
-- get list of scoped variables
|
||||
-- (note includes every variables in the namespace of subnamespace, so subfunctions are scoped alongside this function)
|
||||
if line.scoped then
|
||||
line.scoped = {}
|
||||
for name in pairs(state.variables) do
|
||||
if name:sub(1, #namespace) == namespace then
|
||||
table.insert(line.scoped, name)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- expressions
|
||||
if line.expression then
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ local function parse_line(line, state, namespace)
|
|||
-- get params
|
||||
r.params = {}
|
||||
if r.type == "function" and rem:match("^%b()") then
|
||||
r.scoped = true
|
||||
local content
|
||||
content, rem = rem:match("^(%b())%s*(.*)$")
|
||||
content = content:gsub("^%(", ""):gsub("%)$", "")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue