mirror of
https://github.com/Reuh/candran.git
synced 2026-02-04 02:08:40 +00:00
feat: add prefix attributes in variables declarations
This commit is contained in:
parent
1e118381f8
commit
19405a4d8e
3 changed files with 15 additions and 3 deletions
|
|
@ -8,6 +8,9 @@ tags.AttributeId = (t)
|
|||
return t[1]
|
||||
end
|
||||
end
|
||||
tags.PrefixedAttributeNameList = (t)
|
||||
error("target "..targetName.." does not support variable attributes")
|
||||
end
|
||||
|
||||
#placeholder("patch")
|
||||
|
||||
|
|
|
|||
|
|
@ -465,7 +465,7 @@ return function(code, ast, options, macros={functions={}, variables={}})
|
|||
-- Local{ {attributeident+} {expr+}? }
|
||||
Local = (t)
|
||||
local destructured = {}
|
||||
local r = "local "..push("destructuring", destructured)..lua(t[1], "_lhs")..pop("destructuring")
|
||||
local r = "local "..push("destructuring", destructured)..lua(t[1])..pop("destructuring")
|
||||
if t[2][1] then
|
||||
r ..= " = "..lua(t[2], "_lhs")
|
||||
end
|
||||
|
|
@ -822,6 +822,14 @@ return function(code, ast, options, macros={functions={}, variables={}})
|
|||
end
|
||||
return r
|
||||
end,
|
||||
-- PrefixedAttributeNameList{ attribute {AttributeId+} }
|
||||
PrefixedAttributeNameList = (t)
|
||||
return "<" .. t[1] .. "> " .. lua(t, "_lhs", 2)
|
||||
end,
|
||||
-- AttributeNameList{ {AttributeId+} }
|
||||
AttributeNameList = (t)
|
||||
return lua(t, "_lhs")
|
||||
end,
|
||||
-- AttributeId{ <string> <string>? }
|
||||
AttributeId = (t)
|
||||
if t[2] then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue