1%% 2%% %CopyrightBegin% 3%% 4%% Copyright Ericsson AB 1999-2019. All Rights Reserved. 5%% 6%% Licensed under the Apache License, Version 2.0 (the "License"); 7%% you may not use this file except in compliance with the License. 8%% You may obtain a copy of the License at 9%% 10%% http://www.apache.org/licenses/LICENSE-2.0 11%% 12%% Unless required by applicable law or agreed to in writing, software 13%% distributed under the License is distributed on an "AS IS" BASIS, 14%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15%% See the License for the specific language governing permissions and 16%% limitations under the License. 17%% 18%% %CopyrightEnd% 19%% 20%% Purpose : Core Erlang syntax trees as records. 21 22%% It would be nice to incorporate some generic functions as well but 23%% this could make including this file difficult. 24 25%% Note: the annotation list is *always* the first record field. 26%% Thus it is possible to define the macros: 27%% -define(get_ann(X), element(2, X)). 28%% -define(set_ann(X, Y), setelement(2, X, Y)). 29 30%% The record definitions appear alphabetically 31 32-record(c_alias, {anno=[] :: list(), var :: cerl:cerl(), 33 pat :: cerl:cerl()}). 34 35-record(c_apply, {anno=[] :: list(), op :: cerl:cerl(), 36 args :: [cerl:cerl()]}). 37 38-record(c_binary, {anno=[] :: list(), segments :: [cerl:c_bitstr()]}). 39 40-record(c_bitstr, {anno=[] :: list(), val :: cerl:cerl(), 41 size :: cerl:cerl(), 42 unit :: cerl:cerl(), 43 type :: cerl:cerl(), 44 flags :: cerl:cerl()}). 45 46-record(c_call, {anno=[] :: list(), module :: cerl:cerl(), 47 name :: cerl:cerl(), 48 args :: [cerl:cerl()]}). 49 50-record(c_case, {anno=[] :: list(), arg :: cerl:cerl(), 51 clauses :: [cerl:cerl()]}). 52 53-record(c_catch, {anno=[] :: list(), body :: cerl:cerl()}). 54 55-record(c_clause, {anno=[] :: list(), pats :: [cerl:cerl()], 56 guard :: cerl:cerl(), 57 body :: cerl:cerl() | any()}). % TODO 58 59-record(c_cons, {anno=[] :: list(), hd :: cerl:cerl(), 60 tl :: cerl:cerl()}). 61 62-record(c_fun, {anno=[] :: list(), vars :: [cerl:cerl()], 63 body :: cerl:cerl()}). 64 65-record(c_let, {anno=[] :: list(), vars :: [cerl:cerl()], 66 arg :: cerl:cerl(), 67 body :: cerl:cerl()}). 68 69-record(c_letrec, {anno=[] :: list(), 70 defs :: [{cerl:cerl(), cerl:cerl()}], 71 body :: cerl:cerl()}). 72 73-record(c_literal, {anno=[] :: list(), val :: any()}). 74 75-record(c_map, {anno=[] :: list(), 76 arg=#c_literal{val=#{}} :: cerl:c_var() | cerl:c_literal(), 77 es :: [cerl:c_map_pair()], 78 is_pat=false :: boolean()}). 79 80-record(c_map_pair, {anno=[] :: list(), 81 op :: #c_literal{val::'assoc'} | #c_literal{val::'exact'}, 82 key :: any(), % TODO 83 val :: any()}). % TODO 84 85-record(c_module, {anno=[] :: list(), name :: cerl:cerl(), 86 exports :: [cerl:cerl()], 87 attrs :: [{cerl:cerl(), cerl:cerl()}], 88 defs :: [{cerl:cerl(), cerl:cerl()}]}). 89 90-record(c_primop, {anno=[] :: list(), name :: cerl:cerl(), 91 args :: [cerl:cerl()]}). 92 93-record(c_receive, {anno=[] :: list(), clauses :: [cerl:cerl()], 94 timeout :: cerl:cerl(), 95 action :: cerl:cerl()}). 96 97-record(c_seq, {anno=[] :: list(), arg :: cerl:cerl() | any(), % TODO 98 body :: cerl:cerl()}). 99 100-record(c_try, {anno=[] :: list(), arg :: cerl:cerl(), 101 vars :: [cerl:cerl()], 102 body :: cerl:cerl(), 103 evars :: [cerl:cerl()], 104 handler :: cerl:cerl()}). 105 106-record(c_tuple, {anno=[] :: list(), es :: [cerl:cerl()]}). 107 108-record(c_values, {anno=[] :: list(), es :: [cerl:cerl()]}). 109 110-record(c_var, {anno=[] :: list(), name :: cerl:var_name()}). 111