mirror of
https://github.com/AdaCore/uwrap.git
synced 2026-02-12 13:06:34 -08:00
66 lines
1.5 KiB
Plaintext
66 lines
1.5 KiB
Plaintext
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")>
|
|
],
|
|
"classes": [
|
|
\e<child (wp_Class ()).fold ("", @ & it.contents, @ & ",\n")>
|
|
]
|
|
}""");
|
|
end;
|
|
|
|
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;
|