aboutsummaryrefslogtreecommitdiff
path: root/aoc2023/build/packages/gleam_stdlib/src/gleam@regex.erl
diff options
context:
space:
mode:
authorJ.J <thechairman@thechairman.info>2024-05-30 21:50:02 -0400
committerJ.J <thechairman@thechairman.info>2024-05-30 21:50:02 -0400
commit612fd986ab1e00b6d34dc1937136250e08e89325 (patch)
treea3c93952040c6afdf348b5831619a45db7ba0a2e /aoc2023/build/packages/gleam_stdlib/src/gleam@regex.erl
parent231c2b688d1e6cf0846d46e883da30e042a9c6cf (diff)
downloadgleam_aoc-612fd986ab1e00b6d34dc1937136250e08e89325.tar.gz
gleam_aoc-612fd986ab1e00b6d34dc1937136250e08e89325.zip
cleanup
Diffstat (limited to 'aoc2023/build/packages/gleam_stdlib/src/gleam@regex.erl')
-rw-r--r--aoc2023/build/packages/gleam_stdlib/src/gleam@regex.erl33
1 files changed, 33 insertions, 0 deletions
diff --git a/aoc2023/build/packages/gleam_stdlib/src/gleam@regex.erl b/aoc2023/build/packages/gleam_stdlib/src/gleam@regex.erl
new file mode 100644
index 0000000..2d1c5fc
--- /dev/null
+++ b/aoc2023/build/packages/gleam_stdlib/src/gleam@regex.erl
@@ -0,0 +1,33 @@
+-module(gleam@regex).
+-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function]).
+
+-export([compile/2, from_string/1, check/2, split/2, scan/2]).
+-export_type([regex/0, match/0, compile_error/0, options/0]).
+
+-type regex() :: any().
+
+-type match() :: {match, binary(), list(gleam@option:option(binary()))}.
+
+-type compile_error() :: {compile_error, binary(), integer()}.
+
+-type options() :: {options, boolean(), boolean()}.
+
+-spec compile(binary(), options()) -> {ok, regex()} | {error, compile_error()}.
+compile(Pattern, Options) ->
+ gleam_stdlib:compile_regex(Pattern, Options).
+
+-spec from_string(binary()) -> {ok, regex()} | {error, compile_error()}.
+from_string(Pattern) ->
+ compile(Pattern, {options, false, false}).
+
+-spec check(regex(), binary()) -> boolean().
+check(Regex, Content) ->
+ gleam_stdlib:regex_check(Regex, Content).
+
+-spec split(regex(), binary()) -> list(binary()).
+split(Regex, String) ->
+ gleam_stdlib:regex_split(Regex, String).
+
+-spec scan(regex(), binary()) -> list(match()).
+scan(Regex, String) ->
+ gleam_stdlib:regex_scan(Regex, String).