Skip to content

Commit

Permalink
Added docs to 'pat_regex' module.
Browse files Browse the repository at this point in the history
  • Loading branch information
duncanatt committed Aug 13, 2024
1 parent b60600d commit 6781573
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/pat/pat_regex.erl
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,15 @@
%% TODO: Implement parser and the regular expression simplification functions.
%% TODO: To implement these functions just chuck them as part of the parser file as includes.

%%% ----------------------------------------------------------------------------
%%% Public API.
%%% ----------------------------------------------------------------------------

%% @private Checks whether a mailbox can become potentially empty.
%% @doc Checks whether a mailbox can become potentially empty.
%%
%% @param Regex commutative regular expression to check.
%%
%% @returns true if the mailbox can become potentially empty, false otherwise.
is_mb_empty(Regex) ->
%% case re:run(Regex, "^(\\*.[A-Z][a-z]*|1\s*\\+.*|[A-Z][a-z]+1|[A-Z][a-z]+)$") of
case re:run(trim(Regex), "^(\\*.*|1\\+.*|.*\\+1)$") of
Expand All @@ -31,6 +38,11 @@ is_mb_empty(Regex) ->
simplify([]) ->
ok.

%% @private Removes all the spaces from the specified regular rexpression.
%%
%% @param Regex commutative regular expressions to trim.
%%
%% @returns trimmed regular expression.
trim(Regex) ->
re:replace(Regex, "\s+", "", [global, {return, list}]).

0 comments on commit 6781573

Please sign in to comment.