Compare commits
9 Commits
master
...
extend-aci
Author | SHA1 | Date | |
---|---|---|---|
![]() |
d16fb82e25 | ||
![]() |
d2cd97def7 | ||
![]() |
5455d0fcd7 | ||
![]() |
2d3e6ab6e0 | ||
![]() |
70a0f77793 | ||
![]() |
04b3227317 | ||
![]() |
d9be8b2fca | ||
![]() |
a38afe7693 | ||
![]() |
5719730d8c |
114
docs/aeso_aci.md
114
docs/aeso_aci.md
@ -31,23 +31,48 @@ generates the following JSON structure representing the contract interface:
|
|||||||
{
|
{
|
||||||
"contract": {
|
"contract": {
|
||||||
"name": "Answers",
|
"name": "Answers",
|
||||||
"type_defs": [
|
"state": {
|
||||||
|
"record": [
|
||||||
{
|
{
|
||||||
"name": "state",
|
"name": "a",
|
||||||
"vars": [],
|
"type": {
|
||||||
"typedef": "{a : map(string,int)}"
|
"map": {
|
||||||
|
"key": "string",
|
||||||
|
"value": "int"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
|
"type_defs": [
|
||||||
{
|
{
|
||||||
"name": "answers",
|
"name": "answers",
|
||||||
"vars": [],
|
"vars": [],
|
||||||
"typedef": "map(string,int)"
|
"typedef": {
|
||||||
|
"map": {
|
||||||
|
"key": "string",
|
||||||
|
"value": "int"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"functions": [
|
"functions": [
|
||||||
{
|
{
|
||||||
"name": "init",
|
"name": "init",
|
||||||
"arguments": [],
|
"arguments": [],
|
||||||
"type": "{a : map(string,int)}",
|
"returns": {
|
||||||
|
"record": [
|
||||||
|
{
|
||||||
|
"name": "a",
|
||||||
|
"type": {
|
||||||
|
"map": {
|
||||||
|
"key": "string",
|
||||||
|
"value": "int"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"stateful": true
|
"stateful": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -62,7 +87,12 @@ generates the following JSON structure representing the contract interface:
|
|||||||
"type": "int"
|
"type": "int"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"type": "map(string,int)",
|
"returns": {
|
||||||
|
"map": {
|
||||||
|
"key": "string",
|
||||||
|
"value": "int"
|
||||||
|
}
|
||||||
|
},
|
||||||
"stateful": false
|
"stateful": false
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -85,7 +115,7 @@ json_string() = binary()
|
|||||||
|
|
||||||
### Exports
|
### Exports
|
||||||
|
|
||||||
#### encode(ContractString) -> {ok,JSONstring} | {error,ErrorString}
|
#### encode_contract(ContractString) -> {ok,JSONstring} | {error,ErrorString}
|
||||||
|
|
||||||
Types
|
Types
|
||||||
|
|
||||||
@ -94,9 +124,21 @@ ConstractString = contract_string()
|
|||||||
JSONstring = json_string()
|
JSONstring = json_string()
|
||||||
```
|
```
|
||||||
|
|
||||||
|
This is equivalent to `aeso_aci:encode_contract(ConstractString, [])`.
|
||||||
|
|
||||||
|
#### encode_contract(ContractString, Options) -> {ok,JSONstring} | {error,ErrorString}
|
||||||
|
|
||||||
|
Types
|
||||||
|
|
||||||
|
``` erlang
|
||||||
|
ConstractString = contract_string()
|
||||||
|
Options = [option()]
|
||||||
|
JSONstring = json_string()
|
||||||
|
```
|
||||||
|
|
||||||
Generate the JSON encoding of the interface to a contract. The type definitions and non-private functions are included in the JSON string.
|
Generate the JSON encoding of the interface to a contract. The type definitions and non-private functions are included in the JSON string.
|
||||||
|
|
||||||
#### decode(JSONstring) -> ConstractString.
|
#### decode_contract(JSONstring) -> ConstractString.
|
||||||
|
|
||||||
Types
|
Types
|
||||||
|
|
||||||
@ -107,23 +149,67 @@ JSONstring = json_string()
|
|||||||
|
|
||||||
Take a JSON encoding of a contract interface and generate and generate a contract definition which can be included in another contract.
|
Take a JSON encoding of a contract interface and generate and generate a contract definition which can be included in another contract.
|
||||||
|
|
||||||
|
#### encode_type(TypeAST) -> JSONstring.
|
||||||
|
|
||||||
|
Types
|
||||||
|
|
||||||
|
``` erlang
|
||||||
|
JSONstring = json_string()
|
||||||
|
```
|
||||||
|
|
||||||
|
Generate the JSON encoding of a type from the AST of the type.
|
||||||
|
|
||||||
|
#### encode_arg(ArgAST) -> JSONstring.
|
||||||
|
|
||||||
|
Types
|
||||||
|
|
||||||
|
``` erlang
|
||||||
|
JSONstring = json_string()
|
||||||
|
```
|
||||||
|
|
||||||
|
Generate the JSON encoding of a function argument from the AST of the argument.
|
||||||
|
|
||||||
|
#### encode_stmt(StmtAST) -> JSONstring.
|
||||||
|
|
||||||
|
Types
|
||||||
|
|
||||||
|
``` erlang
|
||||||
|
JSONstring = json_string()
|
||||||
|
```
|
||||||
|
|
||||||
|
Generate the JSON encoding of a statement from the AST of the statement.
|
||||||
|
|
||||||
|
#### encode_expr(ExprAST) -> JSONstring.
|
||||||
|
|
||||||
|
Types
|
||||||
|
|
||||||
|
``` erlang
|
||||||
|
JSONstring = json_string()
|
||||||
|
```
|
||||||
|
|
||||||
|
Generate the JSON encoding of an expression from the AST of the expression.
|
||||||
|
|
||||||
|
### Notes
|
||||||
|
|
||||||
|
The deprecated functions `aseo_aci:encode/2` and `aeso_aci:decode/1` are still available but should not be used.
|
||||||
|
|
||||||
### Example run
|
### Example run
|
||||||
|
|
||||||
This is an example of using the ACI generator from an Erlang shell. The file called `aci_test.aes` contains the contract in the description from which we want to generate files `aci_test.json` which is the JSON encoding of the contract interface and `aci_test.include` which is the contract definition to be included inside another contract.
|
This is an example of using the ACI generator from an Erlang shell. The file called `aci_test.aes` contains the contract in the description from which we want to generate files `aci_test.json` which is the JSON encoding of the contract interface and `aci_test.include` which is the contract definition to be included inside another contract.
|
||||||
|
|
||||||
``` erlang
|
``` erlang
|
||||||
1> {ok,Contract} = file:read_file("aci_test.aes").
|
1> {ok,Contract} = file:read_file("aci_test.aes").
|
||||||
{ok,<<"contract Answers =\n record state = { a : answers }\n type answers() = map(string, int)\n\n stateful function"...>>}
|
{ok,<<"contract Answers =\n\n record state = { a : answers }\n type answers() = map(string, int)\n\n stateful functio"...>>}
|
||||||
2> {ok,Encoding} = aeso_aci:encode(Contract).
|
2> {ok,Encoding} = aeso_aci:encode_contract(Contract).
|
||||||
<<"{\"contract\":{\"name\":\"Answers\",\"type_defs\":[{\"name\":\"state\",\"vars\":[],\"typedef\":\"{a : map(string,int)}\"},{\"name\":\"ans"...>>
|
{ok,<<"{\"contract\":{\"name\":\"Answers\",\"state\":{\"record\":[{\"name\":\"a\",\"type\":{\"map\":{\"key\":\"string\",\"value\":\"int\"}}}]"...>>}
|
||||||
3> file:write_file("aci_test.aci", Encoding).
|
3> file:write_file("aci_test.aci", Encoding).
|
||||||
ok
|
ok
|
||||||
4> Decoded = aeso_aci:decode(Encoding).
|
4> Decoded = aeso_aci:decode_contract(Encoding).
|
||||||
<<"contract Answers =\n function new_answer : (string, int) => map(string, int)\n">>
|
<<"contract Answers =\n function new_answer : (string, int) => map(string, int)\n">>
|
||||||
5> file:write_file("aci_test.include", Decoded).
|
5> file:write_file("aci_test.include", Decoded).
|
||||||
ok
|
ok
|
||||||
6> jsx:prettify(Encoding).
|
6> jsx:prettify(Encoding).
|
||||||
<<"{\n \"contract\": {\n \"name\": \"Answers\",\n \"type_defs\": [\n {\n \"name\": \"state\",\n \"vars\": [],\n "...>>
|
<<"{\n \"contract\": {\n \"name\": \"Answers\",\n \"state\": {\n \"record\": [\n {\n \"name\": \"a\",\n "...>>
|
||||||
```
|
```
|
||||||
|
|
||||||
The final call to `jsx:prettify(Encoding)` returns the encoding in a
|
The final call to `jsx:prettify(Encoding)` returns the encoding in a
|
||||||
|
484
src/aeso_aci.erl
484
src/aeso_aci.erl
@ -9,11 +9,16 @@
|
|||||||
|
|
||||||
-module(aeso_aci).
|
-module(aeso_aci).
|
||||||
|
|
||||||
|
%% Old deprecated interface.
|
||||||
-export([encode/1,encode/2,decode/1]).
|
-export([encode/1,encode/2,decode/1]).
|
||||||
-export([encode_type/1,encode_stmt/1,encode_expr/1]).
|
|
||||||
|
-export([encode_contract/1,encode_contract/2,decode_contract/1]).
|
||||||
|
-export([encode_func/1,encode_type/1,encode_arg/1,
|
||||||
|
encode_stmt/1,encode_expr/1]).
|
||||||
|
|
||||||
%% Define records for the various typed syntactic forms. These make
|
%% Define records for the various typed syntactic forms. These make
|
||||||
%% the code easier but don't seem to exist elsewhere.
|
%% the code easier but don't seem to exist elsewhere. Unfortunately
|
||||||
|
%% sometimes the same typename is used with different fields.
|
||||||
|
|
||||||
%% Top-level
|
%% Top-level
|
||||||
-record(contract, {ann,con,decls}).
|
-record(contract, {ann,con,decls}).
|
||||||
@ -40,6 +45,13 @@
|
|||||||
-record(qcon, {ann,names}).
|
-record(qcon, {ann,names}).
|
||||||
-record(tvar, {ann,name}).
|
-record(tvar, {ann,name}).
|
||||||
|
|
||||||
|
%% Statements
|
||||||
|
-record(block, {ann,body}).
|
||||||
|
-record('if', {ann,test,then,else}). %Both statement and expression
|
||||||
|
-record(letval, {ann,pat,type,exp}).
|
||||||
|
-record(switch, {ann,arg,cases}).
|
||||||
|
-record('case', {ann,pat,body}).
|
||||||
|
|
||||||
%% Expressions
|
%% Expressions
|
||||||
-record(bool, {ann,bool}).
|
-record(bool, {ann,bool}).
|
||||||
-record(int, {ann,value}).
|
-record(int, {ann,value}).
|
||||||
@ -47,36 +59,48 @@
|
|||||||
-record(bytes, {ann,bin}).
|
-record(bytes, {ann,bin}).
|
||||||
-record(tuple, {ann,args}).
|
-record(tuple, {ann,args}).
|
||||||
-record(list, {ann,args}).
|
-record(list, {ann,args}).
|
||||||
|
-record(record, {ann,fields}). %Create a record
|
||||||
|
-record(field, {ann,name,value}). %A record field
|
||||||
|
-record(proj, {ann,value}). %?
|
||||||
|
-record(map, {ann,fields}). %Create a map
|
||||||
|
-record(map_get, {ann,field}).
|
||||||
|
-record(lam, {ann,args,body}).
|
||||||
-record(app, {ann,func,args}).
|
-record(app, {ann,func,args}).
|
||||||
-record(typed, {ann,expr,type}).
|
-record(typed, {ann,expr,type}).
|
||||||
|
|
||||||
%% encode(ContractString) -> {ok,JSON} | {error,String}.
|
%% The old deprecated interface.
|
||||||
%% encode(ContractString, Options) -> {ok,JSON} | {error,String}.
|
|
||||||
|
encode(C) -> encode_contract(C).
|
||||||
|
encode(C, Os) -> encode_contract(C, Os).
|
||||||
|
decode(J) -> decode_contract(J).
|
||||||
|
|
||||||
|
%% encode_contract(ContractString) -> {ok,JSON} | {error,String}.
|
||||||
|
%% encode_contract(ContractString, Options) -> {ok,JSON} | {error,String}.
|
||||||
%% Build a JSON structure with lists and tuples, not maps, as this
|
%% Build a JSON structure with lists and tuples, not maps, as this
|
||||||
%% allows us to order the fields in the contructed JSON string.
|
%% allows us to order the fields in the contructed JSON string.
|
||||||
|
|
||||||
encode(ContractString) -> encode(ContractString, []).
|
encode_contract(ContractString) ->
|
||||||
|
encode_contract(ContractString, []).
|
||||||
encode(ContractString, Options) when is_binary(ContractString) ->
|
encode_contract(ContractString, Options) when is_binary(ContractString) ->
|
||||||
encode(binary_to_list(ContractString), Options);
|
encode_contract(binary_to_list(ContractString), Options);
|
||||||
encode(ContractString, Options) ->
|
encode_contract(ContractString, Options) ->
|
||||||
try
|
try
|
||||||
Ast = parse(ContractString, Options),
|
Ast = parse(ContractString, Options),
|
||||||
%% io:format("~p\n", [Ast]),
|
%% io:format("Ast\n~p\n", [Ast]),
|
||||||
%% aeso_ast:pp(Ast),
|
%% aeso_ast:pp(Ast),
|
||||||
TypedAst = aeso_ast_infer_types:infer(Ast, Options),
|
TypedAst = aeso_ast_infer_types:infer(Ast, Options),
|
||||||
%% io:format("~p\n", [TypedAst]),
|
%% io:format("Typed ast\n~p\n", [TypedAst]),
|
||||||
%% aeso_ast:pp_typed(TypedAst),
|
%% aeso_ast:pp_typed(TypedAst),
|
||||||
%% We find and look at the last contract.
|
%% We find and look at the last contract.
|
||||||
Contract = lists:last(TypedAst),
|
Contract = lists:last(TypedAst),
|
||||||
Cname = contract_name(Contract),
|
Cname = contract_name(Contract),
|
||||||
Tdefs = [ encode_typedef(T) ||
|
Tdefs = do_encode_contract_typedefs(sort_decls(contract_types(Contract))),
|
||||||
T <- sort_decls(contract_types(Contract)) ],
|
Fdefs = [ do_encode_func(F) || F <- sort_decls(contract_funcs(Contract)),
|
||||||
Fdefs = [ encode_func(F) || F <- sort_decls(contract_funcs(Contract)),
|
|
||||||
not is_private_func(F) ],
|
not is_private_func(F) ],
|
||||||
Jmap = [{<<"contract">>, [{<<"name">>, encode_name(Cname)},
|
Jmap = [{<<"contract">>,
|
||||||
{<<"type_defs">>, Tdefs},
|
[{<<"name">>, do_encode_name(Cname)}] ++
|
||||||
{<<"functions">>, Fdefs}]}],
|
Tdefs ++
|
||||||
|
[{<<"functions">>, Fdefs}]}],
|
||||||
%% io:format("~p\n", [Jmap]),
|
%% io:format("~p\n", [Jmap]),
|
||||||
{ok,jsx:encode(Jmap)}
|
{ok,jsx:encode(Jmap)}
|
||||||
catch
|
catch
|
||||||
@ -95,223 +119,375 @@ join_errors(Prefix, Errors, Pfun) ->
|
|||||||
Ess = [ Pfun(E) || E <- Errors ],
|
Ess = [ Pfun(E) || E <- Errors ],
|
||||||
list_to_binary(string:join([Prefix|Ess], "\n")).
|
list_to_binary(string:join([Prefix|Ess], "\n")).
|
||||||
|
|
||||||
%% encode_func(Function) -> JSON
|
%% do_encode_contract_typedefs(TypeDefs) -> [JSON].
|
||||||
|
%% Return a list of typedefs and state and event if they occur.
|
||||||
|
|
||||||
|
do_encode_contract_typedefs(Tdefs) ->
|
||||||
|
Fun = fun(T, {Ts,Ss,Es}) ->
|
||||||
|
%% Only one state and event.
|
||||||
|
case typedef_name(T) of
|
||||||
|
"state" -> {Ts,[do_encode_state_typedef(T)],Es};
|
||||||
|
"event" -> {Ts,Ss,[do_encode_event_typedef(T)]};
|
||||||
|
_Name -> {Ts ++ [do_encode_typedef(T)],Ss,Es}
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
{Ts,Ss,Es} = lists:foldl(Fun, {[],[],[]}, Tdefs),
|
||||||
|
Ss ++ [{<<"type_defs">>, Ts}] ++ Es.
|
||||||
|
|
||||||
|
%% do_encode_state_typedef(StateTdef) -> JSON.
|
||||||
|
%% do_encode_event_typedef(EventTdef) -> JSON.
|
||||||
|
|
||||||
|
do_encode_state_typedef(State) ->
|
||||||
|
Def = typedef_def(State),
|
||||||
|
{<<"state">>,do_encode_alias(Def)}.
|
||||||
|
|
||||||
|
do_encode_event_typedef(State) ->
|
||||||
|
Def = typedef_def(State),
|
||||||
|
{<<"event">>,do_encode_alias(Def)}.
|
||||||
|
|
||||||
|
%% encode_func(TypedAST) -> JSON.
|
||||||
|
%% Encode a function AST into a JSON structure.
|
||||||
|
|
||||||
|
encode_func(AST) ->
|
||||||
|
jsx:encode(do_encode_func(AST)).
|
||||||
|
|
||||||
|
%% do_encode_func(Function) -> JSONmap
|
||||||
%% Encode a function definition. Currently we are only interested in
|
%% Encode a function definition. Currently we are only interested in
|
||||||
%% the interface and type.
|
%% the interface and type.
|
||||||
|
|
||||||
encode_func(Fdef) ->
|
do_encode_func(Fdef) ->
|
||||||
Name = function_name(Fdef),
|
Name = function_name(Fdef),
|
||||||
Args = function_args(Fdef),
|
Args = function_args(Fdef),
|
||||||
Type = function_type(Fdef),
|
Type = function_type(Fdef),
|
||||||
[{<<"name">>, encode_name(Name)},
|
[{<<"name">>, do_encode_name(Name)},
|
||||||
{<<"arguments">>, encode_args(Args)},
|
{<<"arguments">>, do_encode_args(Args)},
|
||||||
{<<"returns">>, encode_type(Type)},
|
{<<"returns">>, do_encode_type(Type)},
|
||||||
{<<"stateful">>, is_stateful_func(Fdef)}].
|
{<<"stateful">>, is_stateful_func(Fdef)}].
|
||||||
|
|
||||||
%% encode_args(Args) -> [JSON].
|
%% encode_arg(TypedAST) -> JSON.
|
||||||
%% encode_arg(Args) -> JSON.
|
%% Encode an argument AST into a JSON structure.
|
||||||
|
|
||||||
encode_args(Args) ->
|
encode_arg(AST) ->
|
||||||
[ encode_arg(A) || A <- Args ].
|
jsx:encode(do_encode_arg(AST)).
|
||||||
|
|
||||||
encode_arg(#arg{id=Id,type=T}) ->
|
%% do_encode_args(ArgASTs) -> [JSONmap].
|
||||||
[{<<"name">>,encode_type(Id)},
|
%% do_encode_arg(ArgAST) -> JSONmap.
|
||||||
{<<"type">>,[encode_type(T)]}].
|
|
||||||
|
|
||||||
%% encode_types(Types) -> [JSON].
|
do_encode_args(Args) ->
|
||||||
%% encode_type(Type) -> JSON.
|
[ do_encode_arg(A) || A <- Args ].
|
||||||
|
|
||||||
encode_types(Types) ->
|
do_encode_arg(#arg{id=Id,type=T}) ->
|
||||||
[ encode_type(T) || T <- Types ].
|
[{<<"name">>,do_encode_type(Id)},
|
||||||
|
{<<"type">>,do_encode_type(T)}].
|
||||||
|
|
||||||
encode_type(#tvar{name=N}) -> encode_name(N);
|
%% encode_type(TypedAST) -> JSON.
|
||||||
encode_type(#id{name=N}) -> encode_name(N);
|
%% Encode a type AST into a JSON structure.
|
||||||
encode_type(#con{name=N}) -> encode_name(N);
|
|
||||||
encode_type(#qid{names=Ns}) ->
|
encode_type(AST) ->
|
||||||
encode_name(lists:join(".", Ns));
|
jsx:encode(do_encode_type(AST)).
|
||||||
encode_type(#qcon{names=Ns}) ->
|
|
||||||
encode_name(lists:join(".", Ns)); %?
|
%% do_encode_types([TypeAST]) -> [JSONmap].
|
||||||
encode_type(#tuple_t{args=As}) ->
|
%% do_encode_type(TypeAST) -> JsonMap.
|
||||||
Eas = encode_types(As),
|
|
||||||
|
do_encode_types(Types) ->
|
||||||
|
[ do_encode_type(T) || T <- Types ].
|
||||||
|
|
||||||
|
do_encode_type(#tvar{name=N}) -> do_encode_name(N);
|
||||||
|
do_encode_type(#id{name=N}) -> do_encode_name(N);
|
||||||
|
do_encode_type(#con{name=N}) -> do_encode_name(N);
|
||||||
|
do_encode_type(#qid{names=Ns}) ->
|
||||||
|
do_encode_name(lists:join(".", Ns));
|
||||||
|
do_encode_type(#qcon{names=Ns}) ->
|
||||||
|
do_encode_name(lists:join(".", Ns)); %?
|
||||||
|
do_encode_type(#tuple_t{args=As}) ->
|
||||||
|
Eas = do_encode_types(As),
|
||||||
[{<<"tuple">>,Eas}];
|
[{<<"tuple">>,Eas}];
|
||||||
encode_type(#bytes_t{len=Len}) ->
|
do_encode_type(#bytes_t{len=Len}) ->
|
||||||
{<<"bytes">>,Len};
|
{<<"bytes">>,Len};
|
||||||
encode_type(#record_t{fields=Fs}) ->
|
do_encode_type(#record_t{fields=Fs}) ->
|
||||||
Efs = encode_fields(Fs),
|
Efs = do_encode_type_rec_fields(Fs),
|
||||||
[{<<"record">>,Efs}];
|
[{<<"record">>,Efs}];
|
||||||
encode_type(#app_t{id=Id,fields=Fs}) ->
|
%% Special case lists and maps as they are built-in types.
|
||||||
Name = encode_type(Id),
|
do_encode_type(#app_t{id=#id{name="list"},fields=[F]}) ->
|
||||||
Efs = encode_types(Fs),
|
Ef = do_encode_type(F),
|
||||||
|
[{<<"list">>,Ef}];
|
||||||
|
do_encode_type(#app_t{id=#id{name="map"},fields=Fs}) ->
|
||||||
|
Ef = do_encode_type_mapo_field(Fs),
|
||||||
|
[{<<"map">>,Ef}];
|
||||||
|
%% Other applications.
|
||||||
|
do_encode_type(#app_t{id=Id,fields=Fs}) ->
|
||||||
|
Name = do_encode_type(Id),
|
||||||
|
Efs = do_encode_types(Fs),
|
||||||
[{Name,Efs}];
|
[{Name,Efs}];
|
||||||
encode_type(#variant_t{cons=Cs}) ->
|
do_encode_type(#variant_t{cons=Cs}) ->
|
||||||
Ecs = encode_types(Cs),
|
Ecs = do_encode_types(Cs),
|
||||||
[{<<"variant">>,Ecs}];
|
[{<<"variant">>,Ecs}];
|
||||||
encode_type(#constr_t{con=C,args=As}) ->
|
do_encode_type(#constr_t{con=C,args=As}) ->
|
||||||
Ec = encode_type(C),
|
Ec = do_encode_type(C),
|
||||||
Eas = encode_types(As),
|
Eas = do_encode_types(As),
|
||||||
[{Ec,Eas}];
|
[{Ec,Eas}];
|
||||||
encode_type(#fun_t{args=As,type=T}) ->
|
do_encode_type(#fun_t{args=As,type=T}) ->
|
||||||
Eas = encode_types(As),
|
Eas = do_encode_types(As),
|
||||||
Et = encode_type(T),
|
Et = do_encode_type(T),
|
||||||
[{<<"function">>,[{<<"arguments">>,Eas},{<<"returns">>,Et}]}].
|
[{<<"function">>,[{<<"arguments">>,Eas},{<<"returns">>,Et}]}].
|
||||||
|
|
||||||
encode_name(Name) ->
|
do_encode_name(Name) ->
|
||||||
list_to_binary(Name).
|
list_to_binary(Name).
|
||||||
|
|
||||||
%% encode_fields(Fields) -> [JSON].
|
%% do_encode_type_rec_fields(Fields) -> [JSONmap].
|
||||||
%% encode_field(Field) -> JSON.
|
%% do_encode_type_rec_field(Field) -> JSONmap.
|
||||||
%% Encode a record field.
|
%% Encode a record field type.
|
||||||
|
|
||||||
encode_fields(Fs) ->
|
do_encode_type_rec_fields(Fs) ->
|
||||||
[ encode_field(F) || F <- Fs ].
|
[ do_encode_type_rec_field(F) || F <- Fs ].
|
||||||
|
|
||||||
encode_field(#field_t{id=Id,type=T}) ->
|
do_encode_type_rec_field(#field_t{id=Id,type=T}) ->
|
||||||
[{<<"name">>,encode_type(Id)},
|
[{<<"name">>,do_encode_type(Id)},
|
||||||
{<<"type">>,[encode_type(T)]}].
|
{<<"type">>,do_encode_type(T)}].
|
||||||
|
|
||||||
%% encode_typedef(TypeDef) -> JSON.
|
%% do_encode_type_mapo_field(Field) -> JSONmap.
|
||||||
|
%% Two fields for one map type.
|
||||||
|
|
||||||
encode_typedef(Type) ->
|
do_encode_type_mapo_field([K,V]) ->
|
||||||
|
[{<<"key">>,do_encode_type(K)},
|
||||||
|
{<<"value">>,do_encode_type(V)}].
|
||||||
|
|
||||||
|
%% do_encode_typedef(TypeDefAST) -> JSON.
|
||||||
|
|
||||||
|
do_encode_typedef(Type) ->
|
||||||
Name = typedef_name(Type),
|
Name = typedef_name(Type),
|
||||||
Vars = typedef_vars(Type),
|
Vars = typedef_vars(Type),
|
||||||
Def = typedef_def(Type),
|
Def = typedef_def(Type),
|
||||||
[{<<"name">>, encode_name(Name)},
|
[{<<"name">>, do_encode_name(Name)},
|
||||||
{<<"vars">>, encode_tvars(Vars)},
|
{<<"vars">>, do_encode_tvars(Vars)},
|
||||||
{<<"typedef">>, encode_alias(Def)}].
|
{<<"typedef">>, do_encode_alias(Def)}].
|
||||||
|
|
||||||
encode_tvars(Vars) ->
|
do_encode_tvars(Vars) ->
|
||||||
[ encode_tvar(V) || V <- Vars ].
|
[ do_encode_tvar(V) || V <- Vars ].
|
||||||
|
|
||||||
encode_tvar(#tvar{name=N}) ->
|
do_encode_tvar(#tvar{name=N}) ->
|
||||||
[{<<"name">>, encode_name(N)}].
|
[{<<"name">>, do_encode_name(N)}].
|
||||||
|
|
||||||
encode_alias(#alias_t{type=T}) ->
|
do_encode_alias(#alias_t{type=T}) ->
|
||||||
encode_type(T);
|
do_encode_type(T);
|
||||||
encode_alias(A) -> encode_type(A).
|
do_encode_alias(A) -> do_encode_type(A).
|
||||||
|
|
||||||
%% encode_stmt(Stmt) -> JSON.
|
%% encode_stmt(StmtAST) -> JSON.
|
||||||
|
%% Encode a statement AST into a JSON structure.
|
||||||
|
|
||||||
encode_stmt(E) ->
|
encode_stmt(AST) ->
|
||||||
encode_expr(E).
|
jsx:encode(do_encode_stmt(AST)).
|
||||||
|
|
||||||
%% encode_exprs(Exprs) -> [JSON].
|
%% do_encode_stmt(StmtAST) -> JSONmap.
|
||||||
%% encode_expr(Expr) -> JSON.
|
|
||||||
|
|
||||||
encode_exprs(Es) ->
|
do_encode_stmt(#typed{expr=E}) -> %Ignore the type
|
||||||
[ encode_expr(E) || E <- Es ].
|
do_encode_stmt(E);
|
||||||
|
do_encode_stmt(#block{body=Body}) ->
|
||||||
|
Eblock = [ do_encode_stmt(B) || B <- Body ],
|
||||||
|
[{<<"block">>,Eblock}];
|
||||||
|
do_encode_stmt(#'if'{test=Test,then=Then,else=Else}) ->
|
||||||
|
%% This is both a statement and en expression.
|
||||||
|
Etest = do_encode_expr(Test),
|
||||||
|
Ethen = do_encode_stmt(Then),
|
||||||
|
Eelse = do_encode_stmt(Else),
|
||||||
|
[{<<"if">>,[{<<"test">>,Etest},{<<"then">>,Ethen},{<<"else">>,Eelse}]}];
|
||||||
|
do_encode_stmt(#letval{pat=Pat,exp=Exp}) ->
|
||||||
|
Epat = do_encode_expr(Pat),
|
||||||
|
Eexp = do_encode_expr(Exp),
|
||||||
|
[{<<"let">>,[{<<"pattern">>,Epat},{<<"expression">>,Eexp}]}];
|
||||||
|
do_encode_stmt(#switch{arg=Arg,cases=Cases}) ->
|
||||||
|
Earg = do_encode_expr(Arg),
|
||||||
|
Ecases = [ do_encode_stmt_case(Case) || Case <- Cases ],
|
||||||
|
[{<<"switch">>,[{<<"arg">>,Earg},{<<"cases">>,Ecases}]}];
|
||||||
|
do_encode_stmt(E) ->
|
||||||
|
do_encode_expr(E).
|
||||||
|
|
||||||
encode_expr(#id{name=N}) -> encode_name(N);
|
do_encode_stmt_case(#'case'{pat=Pat,body=Body}) ->
|
||||||
encode_expr(#con{name=N}) -> encode_name(N);
|
Epat = do_encode_expr(Pat), %Patterns are expessions
|
||||||
encode_expr(#qid{names=Ns}) ->
|
Ebody = do_encode_stmt(Body),
|
||||||
encode_name(lists:join(".", Ns));
|
[{<<"pattern">>,Epat},{<<"body">>,Ebody}].
|
||||||
encode_expr(#qcon{names=Ns}) ->
|
|
||||||
encode_name(lists:join(".", Ns)); %?
|
%% encode_expr(ExprAST) -> JSON.
|
||||||
encode_expr(#typed{expr=E}) ->
|
%% Encode an expression AST into a JSON structure.
|
||||||
encode_expr(E);
|
|
||||||
encode_expr(#bool{bool=B}) -> B;
|
encode_expr(AST) ->
|
||||||
encode_expr(#int{value=V}) -> V;
|
jsx:encode(do_encode_expr(AST)).
|
||||||
encode_expr(#string{bin=B}) -> B;
|
|
||||||
encode_expr(#bytes{bin=B}) -> B;
|
%% do_encode_exprs(ExprASTs) -> [JSONmap].
|
||||||
encode_expr(#tuple{args=As}) ->
|
%% do_encode_expr(ExprAST) -> JSONmap.
|
||||||
Eas = encode_exprs(As),
|
|
||||||
|
do_encode_exprs(Es) ->
|
||||||
|
[ do_encode_expr(E) || E <- Es ].
|
||||||
|
|
||||||
|
do_encode_expr(#typed{expr=E}) -> %Ignore the type
|
||||||
|
do_encode_expr(E);
|
||||||
|
do_encode_expr(#id{name=N}) -> do_encode_name(N);
|
||||||
|
do_encode_expr(#con{name=N}) -> do_encode_name(N);
|
||||||
|
do_encode_expr(#qid{names=Ns}) ->
|
||||||
|
do_encode_name(lists:join(".", Ns));
|
||||||
|
do_encode_expr(#qcon{names=Ns}) ->
|
||||||
|
do_encode_name(lists:join(".", Ns)); %?
|
||||||
|
do_encode_expr(#bool{bool=B}) -> B;
|
||||||
|
do_encode_expr(#int{value=V}) -> V;
|
||||||
|
do_encode_expr(#string{bin=B}) ->
|
||||||
|
[{<<"string">>,B}];
|
||||||
|
do_encode_expr(#bytes{bin=B}) -> B;
|
||||||
|
do_encode_expr(#tuple{args=As}) ->
|
||||||
|
Eas = do_encode_exprs(As),
|
||||||
[{<<"tuple">>,Eas}];
|
[{<<"tuple">>,Eas}];
|
||||||
encode_expr(#list{args=As}) ->
|
do_encode_expr(#list{args=As}) ->
|
||||||
Eas = encode_exprs(As),
|
Eas = do_encode_exprs(As),
|
||||||
[{<<"list">>,Eas}];
|
[{<<"list">>,Eas}];
|
||||||
encode_expr(#app{func=F,args=As}) ->
|
do_encode_expr(#record{fields=Fs}) -> %Create a record
|
||||||
Ef = encode_expr(F),
|
Efs = do_encode_expr_rec_fields(Fs),
|
||||||
Eas = encode_exprs(As),
|
[{<<"create_record">>,Efs}];
|
||||||
|
do_encode_expr({record,_Ann,Rec,Fs}) -> %Update a record
|
||||||
|
Erec = do_encode_expr(Rec),
|
||||||
|
Efs = do_encode_expr_rec_fields(Fs),
|
||||||
|
[{<<"update_record">>,[Erec,Efs]}];
|
||||||
|
do_encode_expr(#lam{args=As,body=B}) ->
|
||||||
|
Eas = do_encode_args(As),
|
||||||
|
Eb = do_encode_stmt(B),
|
||||||
|
[{<<"function">>,[{<<"arguments">>,Eas},{<<"body">>,Eb}]}];
|
||||||
|
do_encode_expr(#map{fields=Fs}) -> %Create a map
|
||||||
|
Efs = do_encode_expr_map_fields(Fs),
|
||||||
|
[{<<"create_map">>,Efs}];
|
||||||
|
do_encode_expr({map,_Ann,Map,Fs}) -> %Update a map
|
||||||
|
Emap = do_encode_expr(Map),
|
||||||
|
Efs = do_encode_expr_map_fields(Fs),
|
||||||
|
[{<<"update_map">>,[Emap,Efs]}];
|
||||||
|
do_encode_expr(#map_get{field=F}) ->
|
||||||
|
do_encode_expr(F);
|
||||||
|
do_encode_expr(#proj{value=V}) ->
|
||||||
|
do_encode_expr(V);
|
||||||
|
do_encode_expr(#app{func=F,args=As}) ->
|
||||||
|
Ef = do_encode_expr(F),
|
||||||
|
Eas = do_encode_exprs(As),
|
||||||
[{<<"apply">>,[{<<"function">>,Ef},
|
[{<<"apply">>,[{<<"function">>,Ef},
|
||||||
{<<"arguments">>,Eas}]}];
|
{<<"arguments">>,Eas}]}];
|
||||||
encode_expr({Op,_Ann}) ->
|
do_encode_expr(#'if'{test=Test,then=Then,else=Else}) ->
|
||||||
|
%% This is both a statement and en expression.
|
||||||
|
Etest = do_encode_expr(Test),
|
||||||
|
Ethen = do_encode_expr(Then),
|
||||||
|
Eelse = do_encode_expr(Else),
|
||||||
|
[{<<"if">>,[{<<"test">>,Etest},{<<"then">>,Ethen},{<<"else">>,Eelse}]}];
|
||||||
|
do_encode_expr({Op,_Ann}) ->
|
||||||
list_to_binary(atom_to_list(Op)).
|
list_to_binary(atom_to_list(Op)).
|
||||||
|
|
||||||
%% decode(JSON) -> ContractString.
|
%% do_encode_expr_rec_fields(Fields) -> [JSON].
|
||||||
|
%% do_encode_expr_rec_field(Field) -> JSON.
|
||||||
|
%% Encode a record field expression.
|
||||||
|
|
||||||
|
do_encode_expr_rec_fields(Fs) ->
|
||||||
|
[ do_encode_expr_rec_field(F) || F <- Fs ].
|
||||||
|
|
||||||
|
do_encode_expr_rec_field(#field{name=[N],value=V}) ->
|
||||||
|
[{<<"name">>,do_encode_expr(N)},
|
||||||
|
{<<"value">>,do_encode_expr(V)}].
|
||||||
|
|
||||||
|
%% do_encode_expr_map_fields(Fields) -> [JSON].
|
||||||
|
%% do_encode_expr_map_field(Field) -> JSON.
|
||||||
|
%% Encode a map field expression.
|
||||||
|
|
||||||
|
do_encode_expr_map_fields(Fs) ->
|
||||||
|
[ do_encode_expr_map_field(F) || F <- Fs ].
|
||||||
|
|
||||||
|
do_encode_expr_map_field({K,V}) ->
|
||||||
|
[{<<"key">>,do_encode_expr(K)},
|
||||||
|
{<<"value">>,do_encode_expr(V)}];
|
||||||
|
do_encode_expr_map_field(#field{name=[K],value=V}) ->
|
||||||
|
[{<<"key">>,do_encode_expr(K)},
|
||||||
|
{<<"value">>,do_encode_expr(V)}].
|
||||||
|
|
||||||
|
%% decode_contract(JSON) -> ContractString.
|
||||||
%% Decode a JSON string and generate a suitable contract string which
|
%% Decode a JSON string and generate a suitable contract string which
|
||||||
%% can be included in a contract definition. We decode into a map
|
%% can be included in a contract definition. We decode into a map
|
||||||
%% here as this is easier to work with and order is not important.
|
%% here as this is easier to work with and order is not important.
|
||||||
|
|
||||||
decode(Json) ->
|
decode_contract(Json) ->
|
||||||
Map = jsx:decode(Json, [return_maps]),
|
Map = jsx:decode(Json, [return_maps]),
|
||||||
%% io:format("~p\n", [Map]),
|
%% io:format("~p\n", [Map]),
|
||||||
#{<<"contract">> := C} = Map,
|
#{<<"contract">> := C} = Map,
|
||||||
list_to_binary(decode_contract(C)).
|
#{<<"name">> := Name, <<"type_defs">> := Ts, <<"functions">> := Fs} = C,
|
||||||
|
CS = ["contract"," ",io_lib:format("~s", [Name])," =\n",
|
||||||
|
do_decode_tdefs(Ts),
|
||||||
|
do_decode_funcs(Fs)],
|
||||||
|
list_to_binary(CS).
|
||||||
|
|
||||||
decode_contract(#{<<"name">> := Name,
|
do_decode_funcs(Fs) -> [ do_decode_func(F) || F <- Fs ].
|
||||||
<<"type_defs">> := Ts,
|
|
||||||
<<"functions">> := Fs}) ->
|
|
||||||
["contract"," ",io_lib:format("~s", [Name])," =\n",
|
|
||||||
decode_tdefs(Ts),
|
|
||||||
decode_funcs(Fs)].
|
|
||||||
|
|
||||||
decode_funcs(Fs) -> [ decode_func(F) || F <- Fs ].
|
do_decode_func(#{<<"name">> := <<"init">>}) -> [];
|
||||||
|
do_decode_func(#{<<"name">> := Name,<<"arguments">> := As,<<"returns">> := T}) ->
|
||||||
decode_func(#{<<"name">> := <<"init">>}) -> [];
|
|
||||||
decode_func(#{<<"name">> := Name,<<"arguments">> := As,<<"returns">> := T}) ->
|
|
||||||
[" function"," ",io_lib:format("~s", [Name])," : ",
|
[" function"," ",io_lib:format("~s", [Name])," : ",
|
||||||
decode_args(As)," => ",decode_type(T),$\n].
|
do_decode_args(As)," => ",do_decode_type(T),$\n].
|
||||||
|
|
||||||
decode_args(As) ->
|
do_decode_args(As) ->
|
||||||
Das = [ decode_arg(A) || A <- As ],
|
Das = [ do_decode_arg(A) || A <- As ],
|
||||||
[$(,lists:join(", ", Das),$)].
|
[$(,lists:join(", ", Das),$)].
|
||||||
|
|
||||||
decode_arg(#{<<"type">> := [T]}) -> decode_type(T).
|
do_decode_arg(#{<<"type">> := T}) -> do_decode_type(T).
|
||||||
|
|
||||||
decode_types(Ets) ->
|
do_decode_types(Ets) ->
|
||||||
[ decode_type(Et) || Et <- Ets ].
|
[ do_decode_type(Et) || Et <- Ets ].
|
||||||
|
|
||||||
decode_type(#{<<"tuple">> := Ets}) ->
|
do_decode_type(#{<<"tuple">> := Ets}) ->
|
||||||
Ts = decode_types(Ets),
|
Ts = do_decode_types(Ets),
|
||||||
[$(,lists:join(", ", Ts),$)];
|
[$(,lists:join(", ", Ts),$)];
|
||||||
decode_type(#{<<"record">> := Efs}) ->
|
do_decode_type(#{<<"record">> := Efs}) ->
|
||||||
Fs = decode_fields(Efs),
|
Fs = do_decode_type_rec_fields(Efs),
|
||||||
[${,lists:join(", ", Fs),$}];
|
[${,lists:join(", ", Fs),$}];
|
||||||
decode_type(#{<<"list">> := [Et]}) ->
|
do_decode_type(#{<<"list">> := Et}) ->
|
||||||
T = decode_type(Et),
|
T = do_decode_type(Et),
|
||||||
["list",$(,T,$)];
|
["list",$(,T,$)];
|
||||||
decode_type(#{<<"map">> := Ets}) ->
|
do_decode_type(#{<<"map">> := Et}) ->
|
||||||
Ts = decode_types(Ets),
|
T = do_decode_type_map(Et),
|
||||||
["map",$(,lists:join(",", Ts),$)];
|
["map",$(,T,$)];
|
||||||
decode_type(#{<<"variant">> := Ets}) ->
|
do_decode_type(#{<<"variant">> := Ets}) ->
|
||||||
Ts = decode_types(Ets),
|
Ts = do_decode_types(Ets),
|
||||||
lists:join(" | ", Ts);
|
lists:join(" | ", Ts);
|
||||||
decode_type(Econs) when is_map(Econs) -> %General constructor
|
do_decode_type(Econs) when is_map(Econs) -> %General constructor
|
||||||
|
%% io:format("~p\n", [Econs]),
|
||||||
[{Ec,Ets}] = maps:to_list(Econs),
|
[{Ec,Ets}] = maps:to_list(Econs),
|
||||||
C = decode_name(Ec),
|
C = do_decode_name(Ec),
|
||||||
Ts = decode_types(Ets),
|
Ts = do_decode_types(Ets),
|
||||||
[C,$(,lists:join(", ", Ts),$)];
|
[C,$(,lists:join(", ", Ts),$)];
|
||||||
decode_type(T) -> %Just raw names.
|
do_decode_type(T) -> %Just raw names.
|
||||||
decode_name(T).
|
do_decode_name(T).
|
||||||
|
|
||||||
decode_name(En) ->
|
do_decode_name(En) ->
|
||||||
binary_to_list(En).
|
binary_to_list(En).
|
||||||
|
|
||||||
decode_fields(Efs) ->
|
do_decode_type_rec_fields(Efs) ->
|
||||||
[ decode_field(Ef) || Ef <- Efs ].
|
[ do_decode_type_rec_field(Ef) || Ef <- Efs ].
|
||||||
|
|
||||||
decode_field(#{<<"name">> := En,<<"type">> := [Et]}) ->
|
do_decode_type_rec_field(#{<<"name">> := En,<<"type">> := Et}) ->
|
||||||
Name = decode_name(En),
|
Name = do_decode_name(En),
|
||||||
Type = decode_type(Et),
|
Type = do_decode_type(Et),
|
||||||
[Name," : ",Type].
|
[Name," : ",Type].
|
||||||
|
|
||||||
%% decode_tdefs(Json) -> [TypeString].
|
do_decode_type_map(#{<<"key">> := Ek,<<"value">> := Ev}) ->
|
||||||
|
Key = do_decode_type(Ek),
|
||||||
|
Value = do_decode_type(Ev),
|
||||||
|
[Key,", ",Value].
|
||||||
|
|
||||||
|
%% do_decode_tdefs(Json) -> [TypeString].
|
||||||
%% Here we are only interested in the type definitions and ignore the
|
%% Here we are only interested in the type definitions and ignore the
|
||||||
%% aliases. We find them as they always have variants.
|
%% aliases. We find them as they always have variants.
|
||||||
|
|
||||||
decode_tdefs(Ts) -> [ decode_tdef(T) ||
|
do_decode_tdefs(Ts) -> [ do_decode_tdef(T) ||
|
||||||
#{<<"typedef">> := #{<<"variant">> := _}} = T <- Ts
|
#{<<"typedef">> := #{<<"variant">> := _}} = T <- Ts
|
||||||
].
|
].
|
||||||
|
|
||||||
decode_tdef(#{<<"name">> := Name,<<"vars">> := Vs,<<"typedef">> := T}) ->
|
do_decode_tdef(#{<<"name">> := Name,<<"vars">> := Vs,<<"typedef">> := T}) ->
|
||||||
[" datatype"," ",decode_name(Name),decode_tvars(Vs),
|
[" datatype"," ",do_decode_name(Name),do_decode_tvars(Vs),
|
||||||
" = ",decode_type(T),$\n].
|
" = ",do_decode_type(T),$\n].
|
||||||
|
|
||||||
decode_tvars([]) -> []; %No tvars, no parentheses
|
do_decode_tvars([]) -> []; %No tvars, no parentheses
|
||||||
decode_tvars(Vs) ->
|
do_decode_tvars(Vs) ->
|
||||||
Dvs = [ decode_tvar(V) || V <- Vs ],
|
Dvs = [ do_decode_tvar(V) || V <- Vs ],
|
||||||
[$(,lists:join(", ", Dvs),$)].
|
[$(,lists:join(", ", Dvs),$)].
|
||||||
|
|
||||||
decode_tvar(#{<<"name">> := N}) -> io_lib:format("~s", [N]).
|
do_decode_tvar(#{<<"name">> := N}) -> io_lib:format("~s", [N]).
|
||||||
|
|
||||||
%% #contract{Ann, Con, [Declarations]}.
|
%% #contract{Ann, Con, [Declarations]}.
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ test_cases(1) ->
|
|||||||
[#{<<"name">> => <<"a">>,
|
[#{<<"name">> => <<"a">>,
|
||||||
<<"arguments">> =>
|
<<"arguments">> =>
|
||||||
[#{<<"name">> => <<"i">>,
|
[#{<<"name">> => <<"i">>,
|
||||||
<<"type">> => [<<"int">>]}],
|
<<"type">> => <<"int">>}],
|
||||||
<<"returns">> => <<"int">>,
|
<<"returns">> => <<"int">>,
|
||||||
<<"stateful">> => false}]}},
|
<<"stateful">> => false}]}},
|
||||||
DecACI = <<"contract C =\n"
|
DecACI = <<"contract C =\n"
|
||||||
@ -44,7 +44,7 @@ test_cases(2) ->
|
|||||||
<<"functions">> =>
|
<<"functions">> =>
|
||||||
[#{<<"arguments">> =>
|
[#{<<"arguments">> =>
|
||||||
[#{<<"name">> => <<"i">>,
|
[#{<<"name">> => <<"i">>,
|
||||||
<<"type">> => [<<"int">>]}],
|
<<"type">> => <<"int">>}],
|
||||||
<<"name">> => <<"a">>,
|
<<"name">> => <<"a">>,
|
||||||
<<"returns">> => <<"int">>,
|
<<"returns">> => <<"int">>,
|
||||||
<<"stateful">> => false}]}},
|
<<"stateful">> => false}]}},
|
||||||
@ -60,7 +60,7 @@ test_cases(3) ->
|
|||||||
[#{<<"arguments">> =>
|
[#{<<"arguments">> =>
|
||||||
[#{<<"name">> => <<"i">>,
|
[#{<<"name">> => <<"i">>,
|
||||||
<<"type">> =>
|
<<"type">> =>
|
||||||
[#{<<"C.bert">> => [<<"string">>]}]}],
|
#{<<"C.bert">> => [<<"string">>]}}],
|
||||||
<<"name">> => <<"a">>,<<"returns">> => <<"int">>,
|
<<"name">> => <<"a">>,<<"returns">> => <<"int">>,
|
||||||
<<"stateful">> => false}],
|
<<"stateful">> => false}],
|
||||||
<<"name">> => <<"C">>,
|
<<"name">> => <<"C">>,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user