erlang-e0b609ee.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. import{g as p}from"./index-d7fba904.js";function c(r,o){for(var t=0;t<o.length;t++){const n=o[t];if(typeof n!="string"&&!Array.isArray(n)){for(const e in n)if(e!=="default"&&!(e in r)){const i=Object.getOwnPropertyDescriptor(n,e);i&&Object.defineProperty(r,e,i.get?i:{enumerable:!0,get:()=>n[e]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}var a={exports:{}};(function(r,o){ace.define("ace/snippets/erlang.snippets",["require","exports","module"],function(t,n,e){e.exports=`# module and export all
  2. snippet mod
  3. -module(\${1:\`Filename('', 'my')\`}).
  4. -compile([export_all]).
  5. start() ->
  6. \${2}
  7. stop() ->
  8. ok.
  9. # define directive
  10. snippet def
  11. -define(\${1:macro}, \${2:body}).\${3}
  12. # export directive
  13. snippet exp
  14. -export([\${1:function}/\${2:arity}]).
  15. # include directive
  16. snippet inc
  17. -include("\${1:file}").\${2}
  18. # behavior directive
  19. snippet beh
  20. -behaviour(\${1:behaviour}).\${2}
  21. # if expression
  22. snippet if
  23. if
  24. \${1:guard} ->
  25. \${2:body}
  26. end
  27. # case expression
  28. snippet case
  29. case \${1:expression} of
  30. \${2:pattern} ->
  31. \${3:body};
  32. end
  33. # anonymous function
  34. snippet fun
  35. fun (\${1:Parameters}) -> \${2:body} end\${3}
  36. # try...catch
  37. snippet try
  38. try
  39. \${1}
  40. catch
  41. \${2:_:_} -> \${3:got_some_exception}
  42. end
  43. # record directive
  44. snippet rec
  45. -record(\${1:record}, {
  46. \${2:field}=\${3:value}}).\${4}
  47. # todo comment
  48. snippet todo
  49. %% TODO: \${1}
  50. ## Snippets below (starting with '%') are in EDoc format.
  51. ## See http://www.erlang.org/doc/apps/edoc/chapter.html#id56887 for more details
  52. # doc comment
  53. snippet %d
  54. %% @doc \${1}
  55. # end of doc comment
  56. snippet %e
  57. %% @end
  58. # specification comment
  59. snippet %s
  60. %% @spec \${1}
  61. # private function marker
  62. snippet %p
  63. %% @private
  64. # OTP application
  65. snippet application
  66. -module(\${1:\`Filename('', 'my')\`}).
  67. -behaviour(application).
  68. -export([start/2, stop/1]).
  69. start(_Type, _StartArgs) ->
  70. case \${2:root_supervisor}:start_link() of
  71. {ok, Pid} ->
  72. {ok, Pid};
  73. Other ->
  74. {error, Other}
  75. end.
  76. stop(_State) ->
  77. ok.
  78. # OTP supervisor
  79. snippet supervisor
  80. -module(\${1:\`Filename('', 'my')\`}).
  81. -behaviour(supervisor).
  82. %% API
  83. -export([start_link/0]).
  84. %% Supervisor callbacks
  85. -export([init/1]).
  86. -define(SERVER, ?MODULE).
  87. start_link() ->
  88. supervisor:start_link({local, ?SERVER}, ?MODULE, []).
  89. init([]) ->
  90. Server = {\${2:my_server}, {$2, start_link, []},
  91. permanent, 2000, worker, [$2]},
  92. Children = [Server],
  93. RestartStrategy = {one_for_one, 0, 1},
  94. {ok, {RestartStrategy, Children}}.
  95. # OTP gen_server
  96. snippet gen_server
  97. -module(\${1:\`Filename('', 'my')\`}).
  98. -behaviour(gen_server).
  99. %% API
  100. -export([
  101. start_link/0
  102. ]).
  103. %% gen_server callbacks
  104. -export([init/1, handle_call/3, handle_cast/2, handle_info/2,
  105. terminate/2, code_change/3]).
  106. -define(SERVER, ?MODULE).
  107. -record(state, {}).
  108. %%%===================================================================
  109. %%% API
  110. %%%===================================================================
  111. start_link() ->
  112. gen_server:start_link({local, ?SERVER}, ?MODULE, [], []).
  113. %%%===================================================================
  114. %%% gen_server callbacks
  115. %%%===================================================================
  116. init([]) ->
  117. {ok, #state{}}.
  118. handle_call(_Request, _From, State) ->
  119. Reply = ok,
  120. {reply, Reply, State}.
  121. handle_cast(_Msg, State) ->
  122. {noreply, State}.
  123. handle_info(_Info, State) ->
  124. {noreply, State}.
  125. terminate(_Reason, _State) ->
  126. ok.
  127. code_change(_OldVsn, State, _Extra) ->
  128. {ok, State}.
  129. %%%===================================================================
  130. %%% Internal functions
  131. %%%===================================================================
  132. `}),ace.define("ace/snippets/erlang",["require","exports","module","ace/snippets/erlang.snippets"],function(t,n,e){n.snippetText=t("./erlang.snippets"),n.scope="erlang"}),function(){ace.require(["ace/snippets/erlang"],function(t){r&&(r.exports=t)})}()})(a);var s=a.exports;const l=p(s),u=c({__proto__:null,default:l},[s]);export{u as e};