Files
uwrap/include/proxy/proxy.wrp

66 lines
1.5 KiB
Plaintext
Raw Permalink Normal View History

template wp_Proxy do
end;
template wp_NamedProxy extends wp_Proxy do
var name : text;
var symbol : text;
end;
template wp_Unit extends wp_NamedProxy do
# TODO: this shoud really be: \e<child (\ v: wp_Function ()).fold (c: "", c: (c & v.contents), c: (c & ",\n"))>
# doesn't work for now, reg exp for wrappers are broken. to fix...
var contents : text => defer (i"""
{
"name":"\e<name>",
"functions": [
\e<child (wp_Function ()).filter (\ true).fold ("", @ & it.contents, @ & ",\n")>
2020-08-20 23:33:39 -04:00
],
"classes": [
\e<child (wp_Class ()).fold ("", @ & it.contents, @ & ",\n")>
]
}""");
end;
2020-08-20 23:33:39 -04:00
template wp_Class extends wp_NamedProxy do
var contents: text => defer (i"""
{
"name": "\e<name>"
}
""");
end;
template wp_Function extends wp_NamedProxy do
var type : text;
var contents : text => defer(i"""
{
"name": "\e<name>",
"symbol": "\e<symbol>",
"type": "\e<type>",
"parameters": [
\e<child (wp_Parameter ()).fold ("", @ & it.contents, @ & ",\n")>
]
}""");
end;
template wp_Parameter extends wp_NamedProxy do
var type : text;
var contents : text => defer(i"""
{
"name": "\e<name>",
"type": "\e<type>"
}""");
end;
template wp_TypeExpr extends wp_Proxy do
var txt : text;
end;
template generate_proxy2json pick origin do
match wp_Unit ()
wrap standard.file (defer (name & ".json"), defer (contents));
end;