macro Estruct(name,arg,type,max=100,min=0,descritpion="")
:(struct $(esc(name))
$((esc(arg)))
$(esc(name))($(esc(arg)))=new(
check($(esc(type)),$(esc(arg)),$(esc(name)),$(esc(max)),$(esc(min)),$(esc(descritpion))))
end)
end
我该如何实现这个宏?
,就像这样:@Estruct begin
B
arg1
Float64
200.0
5.0
"this"
end
我不知道如何创建多行宏。我以为只需要添加begin和end,但我总是得到一个错误: MethodError: no method matching var"@Estruct"(::LineNumberNode, ::Module, ::Expr)