X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2Fre-engine-Plugin.git;a=blobdiff_plain;f=README;h=d6e41383509c641683a181a4afc86422ffad33b1;hp=9da0ecf52406a10dfc133c87339060e5d39465a5;hb=182fcce5112d0394e1678a80b3f17b3581918f7e;hpb=de28b8b2f575972f4c8ccb7f037db6f3b38860cf diff --git a/README b/README index 9da0ecf..d6e4138 100644 --- a/README +++ b/README @@ -1,6 +1,9 @@ NAME re::engine::Plugin - API to write custom regex engines +VERSION + Version 0.10 + DESCRIPTION As of perl 5.9.5 it's possible to lexically replace perl's built-in regular expression engine with your own (see perlreapi and perlpragma). @@ -113,6 +116,9 @@ CALLBACKS routine should return a true value if the match was successful, and a false one if it wasn't. + This callback can also be specified on an individual basis with the + "callbacks" method. + METHODS str "str" ~~ /pattern/; @@ -167,6 +173,31 @@ METHODS The length specified will be used as a a byte length (using SvPV), not a character length. + nparens + gofs + callbacks + # A dumb regexp engine that just tests string equality + use re::engine::Plugin comp => sub { + my ($re) = @_; + + my $pat = $re->pattern; + + $re->callbacks( + exec => sub { + my ($re, $str) = @_; + return $pat eq $str; + }, + ); + }; + + Takes a list of key-value pairs of names and subroutines, and replace + the callback currently attached to the regular expression for the type + given as the key by the code reference passed as the corresponding + value. + + The only valid key is currently "exec". See "exec" for more details + about this callback. + num_captures $re->num_captures( FETCH => sub { @@ -213,7 +244,17 @@ METHODS methods FETCH, STORE, DELETE, CLEAR, EXISTS, FIRSTKEY, NEXTKEY and SCALAR. -Tainting +CONSTANTS + "REP_THREADSAFE" + True iff the module could have been built with thread-safety features + enabled. + + "REP_FORKSAFE" + True iff this module could have been built with fork-safety features + enabled. This will always be true except on Windows where it's false for + perl 5.10.0 and below. + +TAINTING The only way to untaint an existing variable in Perl is to use it as a hash key or referencing subpatterns from a regular expression match (see perlsec), the latter only works in perl's regex engine because it @@ -270,7 +311,7 @@ Tainting SEE ALSO perlreapi, Taint::Util -TODO / CAVEATS +TODO & CAVEATS *here be dragons* * Engines implemented with this module don't support "s///" and "split @@ -340,20 +381,28 @@ TODO / CAVEATS checkstr callbacks are called. Write wrappers around them and add tests. +DEPENDENCIES + perl 5.10. + + A C compiler. This module may happen to build with a C++ compiler as + well, but don't rely on it, as no guarantee is made in this regard. + + XSLoader (standard since perl 5.6.0). + BUGS Please report any bugs that aren't already listed at to AUTHORS - Ævar Arnfjörð Bjarmason "" + Ævar Arnfjörð Bjarmason "" Vincent Pit "" LICENSE - Copyright 2007-2008 Ævar Arnfjörð Bjarmason. + Copyright 2007,2008 Ævar Arnfjörð Bjarmason. - Copyright 2009 Vincent Pit. + Copyright 2009,2010,2011,2013,2014 Vincent Pit. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.