From 67815731ccacf3fe90d7400bc42e20bd7972399d Mon Sep 17 00:00:00 2001 From: Duncan Paul Attard Date: Tue, 13 Aug 2024 17:54:04 +0100 Subject: [PATCH] Added docs to 'pat_regex' module. --- src/pat/pat_regex.erl | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/pat/pat_regex.erl b/src/pat/pat_regex.erl index 970da70..965b854 100644 --- a/src/pat/pat_regex.erl +++ b/src/pat/pat_regex.erl @@ -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 @@ -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}]).