Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:25
erlang
4511-re-Rework-option-types.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 4511-re-Rework-option-types.patch of Package erlang
From eb4a9c1e45bccf8d5463ec69198db41149eda823 Mon Sep 17 00:00:00 2001 From: Lukas Larsson <lukas@erlang.org> Date: Thu, 4 Jan 2024 20:35:18 +0100 Subject: [PATCH 1/6] re: Rework option types --- lib/stdlib/doc/src/re.xml | 8 ++++++++ lib/stdlib/src/re.erl | 31 +++++++++++++++++-------------- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/lib/stdlib/doc/src/re.xml b/lib/stdlib/doc/src/re.xml index d18b976d65..1fba72be72 100644 --- a/lib/stdlib/doc/src/re.xml +++ b/lib/stdlib/doc/src/re.xml @@ -73,8 +73,14 @@ <name name="nl_spec"/> </datatype> <datatype> + <name name="compile_options"/> <name name="compile_option"/> </datatype> + <datatype> + <name name="options"/> + <name name="option"/> + <name name="capture"/> + </datatype> <datatype> <name name="replace_fun"/> </datatype> @@ -454,6 +460,8 @@ re:replace("abcd", ".(.)", fun(Whole, [<<C>>]) -> <<$#, Whole/ subpatterns.</fsummary> <type_desc variable="CompileOpt">See <seeerl marker="#compile_options"> <c>compile/2</c></seeerl>.</type_desc> + <type name="option"/> + <type name="capture"/> <desc> <p>Executes a regular expression matching, and returns <c>match/{match, <anno>Captured</anno>}</c> or <c>nomatch</c>. The diff --git a/lib/stdlib/src/re.erl b/lib/stdlib/src/re.erl index 0f1f9a137a..e53a2732c4 100644 --- a/lib/stdlib/src/re.erl +++ b/lib/stdlib/src/re.erl @@ -20,10 +20,13 @@ -module(re). -export([grun/3,urun/3,ucompile/2,replace/3,replace/4,split/2,split/3]). +-export_type([mp/0, compile_options/0, options/0]). + -type mp() :: {re_pattern, _, _, _, _}. -type nl_spec() :: cr | crlf | lf | anycrlf | any. +-type compile_options() :: [compile_option()]. -type compile_option() :: unicode | anchored | caseless | dollar_endonly | dotall | extended | firstline | multiline | no_auto_capture | dupnames | ungreedy @@ -31,6 +34,19 @@ | bsr_anycrlf | bsr_unicode | no_start_optimize | ucp | never_utf. +-type options() :: [option()]. +-type option() :: anchored | global | notbol | noteol | notempty | + notempty_atstart | report_errors | + {offset, non_neg_integer()} | + {match_limit, non_neg_integer()} | + {match_limit_recursion, non_neg_integer()} | + {newline, NLSpec :: nl_spec()} | + bsr_anycrlf | bsr_unicode | {capture, ValueSpec :: capture()} | + {capture, ValueSpec :: capture(), Type :: index | list | binary} | + compile_option(). +-type capture() :: all | all_but_first | all_names | first | none | + ValueList :: [integer() | string() | atom()]. + -type replace_fun() :: fun((binary(), [binary()]) -> iodata() | unicode:charlist()). %%% BIFs @@ -81,20 +97,7 @@ run(_, _) -> {error, ErrType} when Subject :: iodata() | unicode:charlist(), RE :: mp() | iodata() | unicode:charlist(), - Options :: [Option], - Option :: anchored | global | notbol | noteol | notempty - | notempty_atstart | report_errors - | {offset, non_neg_integer()} | - {match_limit, non_neg_integer()} | - {match_limit_recursion, non_neg_integer()} | - {newline, NLSpec :: nl_spec()} | - bsr_anycrlf | bsr_unicode | {capture, ValueSpec} | - {capture, ValueSpec, Type} | CompileOpt, - Type :: index | list | binary, - ValueSpec :: all | all_but_first | all_names | first | none | ValueList, - ValueList :: [ValueID], - ValueID :: integer() | string() | atom(), - CompileOpt :: compile_option(), + Options :: options(), Captured :: [CaptureData] | [[CaptureData]], CaptureData :: {integer(), integer()} | ListConversionData -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor