Skip to content

Commit ffd7863

Browse files
committed
Add missing declaration for binary:match/2,3
Signed-off-by: Paul Guyot <pguyot@kallisys.net>
1 parent b57b94f commit ffd7863

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

libs/estdlib/src/binary.erl

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
encode_hex/1, encode_hex/2,
3333
part/3,
3434
split/2, split/3,
35+
match/2, match/3,
3536
replace/3, replace/4
3637
]).
3738

@@ -103,6 +104,33 @@ encode_hex(Data, uppercase) ->
103104
encode_hex(Data, lowercase) ->
104105
<<<<(hd(string:to_lower(integer_to_list(B, 16)))):8>> || <<B:4>> <= Data>>.
105106

107+
%%-----------------------------------------------------------------------------
108+
%% @equiv match(Binary, Pattern, [])
109+
%% @param Binary binary to search in
110+
%% @param Pattern pattern to search for
111+
%% @returns `{Start, Length}' or `nomatch'
112+
%% @doc Find the first occurrence of Pattern in Binary.
113+
%% @end
114+
%%-----------------------------------------------------------------------------
115+
-spec match(Binary :: binary(), Pattern :: binary() | [binary()]) ->
116+
{non_neg_integer(), non_neg_integer()} | nomatch.
117+
match(_Binary, _Pattern) ->
118+
erlang:nif_error(undefined).
119+
120+
%%-----------------------------------------------------------------------------
121+
%% @param Binary binary to search in
122+
%% @param Pattern pattern to search for
123+
%% @param Options options for the match
124+
%% @returns `{Start, Length}' or `nomatch'
125+
%% @doc Find the first occurrence of Pattern in Binary.
126+
%% Options can include `{scope, {Start, Length}}'.
127+
%% @end
128+
%%-----------------------------------------------------------------------------
129+
-spec match(Binary :: binary(), Pattern :: binary() | [binary()], Options :: [term()]) ->
130+
{non_neg_integer(), non_neg_integer()} | nomatch.
131+
match(_Binary, _Pattern, _Options) ->
132+
erlang:nif_error(undefined).
133+
106134
%%-----------------------------------------------------------------------------
107135
%% @param Binary binary to extract a subbinary from
108136
%% @param Pos 0-based index of the subbinary to extract

0 commit comments

Comments
 (0)