aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Rubio <[email protected]>2017-03-31 01:14:07 +0100
committerManuel Rubio <[email protected]>2017-03-31 01:14:07 +0100
commit74dc036b67427987f54b45beb3adcccd2cf2e27a (patch)
treebcd80b9d3ea43486b11aa77a089bb1c3275cdb80
parent5da9e0ab5cb96f2cb37e534b2c1a55c0c2c9783c (diff)
downloadotp-74dc036b67427987f54b45beb3adcccd2cf2e27a.tar.gz
otp-74dc036b67427987f54b45beb3adcccd2cf2e27a.tar.bz2
otp-74dc036b67427987f54b45beb3adcccd2cf2e27a.zip
Add re:version/0
-rw-r--r--erts/emulator/beam/bif.tab1
-rw-r--r--erts/emulator/beam/erl_bif_re.c11
-rw-r--r--lib/stdlib/src/re.erl7
3 files changed, 18 insertions, 1 deletions
diff --git a/erts/emulator/beam/bif.tab b/erts/emulator/beam/bif.tab
index 6f50297fc5..b0819c6427 100644
--- a/erts/emulator/beam/bif.tab
+++ b/erts/emulator/beam/bif.tab
@@ -392,6 +392,7 @@ bif erl_ddll:demonitor/1
#
# Bifs in the re module
#
+bif re:version/0
bif re:compile/1
bif re:compile/2
bif re:run/2
diff --git a/erts/emulator/beam/erl_bif_re.c b/erts/emulator/beam/erl_bif_re.c
index a66b05c6ff..5dbf2a7de0 100644
--- a/erts/emulator/beam/erl_bif_re.c
+++ b/erts/emulator/beam/erl_bif_re.c
@@ -477,6 +477,17 @@ build_compile_result(Process *p, Eterm error_tag, pcre *result, int errcode, con
* Compile BIFs
*/
+BIF_RETTYPE
+re_version_0(BIF_ALIST_0)
+{
+ Eterm ret;
+ size_t version_size = 0;
+ byte *version = (byte *) erts_pcre_version();
+ version_size = strlen((const char *) version);
+ ret = new_binary(BIF_P, version, version_size);
+ BIF_RET(ret);
+}
+
static BIF_RETTYPE
re_compile(Process* p, Eterm arg1, Eterm arg2)
{
diff --git a/lib/stdlib/src/re.erl b/lib/stdlib/src/re.erl
index 52d3c35608..28aab7b590 100644
--- a/lib/stdlib/src/re.erl
+++ b/lib/stdlib/src/re.erl
@@ -33,7 +33,12 @@
%%% BIFs
--export([compile/1, compile/2, run/2, run/3, inspect/2]).
+-export([version/0, compile/1, compile/2, run/2, run/3, inspect/2]).
+
+-spec version() -> binary().
+
+version() ->
+ erlang:nif_error(undef).
-spec compile(Regexp) -> {ok, MP} | {error, ErrSpec} when
Regexp :: iodata(),