Merge branch 'master' of git://factorcode.org/git/factor
commit
4ab91ee742
|
@ -1,6 +1,6 @@
|
||||||
! Copyright (C) 2008 Doug Coleman.
|
! Copyright (C) 2008 Doug Coleman.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors hashtables kernel math state-tables vars vectors ;
|
USING: accessors hashtables kernel math state-tables vectors ;
|
||||||
IN: regexp.backend
|
IN: regexp.backend
|
||||||
|
|
||||||
TUPLE: regexp
|
TUPLE: regexp
|
||||||
|
|
|
@ -294,6 +294,7 @@ ERROR: unrecognized-escape char ;
|
||||||
read1
|
read1
|
||||||
{
|
{
|
||||||
{ CHAR: \ [ CHAR: \ <constant> ] }
|
{ CHAR: \ [ CHAR: \ <constant> ] }
|
||||||
|
{ CHAR: / [ CHAR: / <constant> ] }
|
||||||
{ CHAR: ^ [ CHAR: ^ <constant> ] }
|
{ CHAR: ^ [ CHAR: ^ <constant> ] }
|
||||||
{ CHAR: $ [ CHAR: $ <constant> ] }
|
{ CHAR: $ [ CHAR: $ <constant> ] }
|
||||||
{ CHAR: - [ CHAR: - <constant> ] }
|
{ CHAR: - [ CHAR: - <constant> ] }
|
||||||
|
|
|
@ -55,6 +55,10 @@ IN: regexp-tests
|
||||||
[ t ] [ " " "[\\W]" <regexp> matches? ] unit-test
|
[ t ] [ " " "[\\W]" <regexp> matches? ] unit-test
|
||||||
[ f ] [ "a" "[\\W]" <regexp> matches? ] unit-test
|
[ f ] [ "a" "[\\W]" <regexp> matches? ] unit-test
|
||||||
|
|
||||||
|
[ t ] [ "/" "\\/" <regexp> matches? ] unit-test
|
||||||
|
|
||||||
|
[ t ] [ "a" R' a'i matches? ] unit-test
|
||||||
|
|
||||||
[ t ] [ "" "a|b*|c+|d?" <regexp> matches? ] unit-test
|
[ t ] [ "" "a|b*|c+|d?" <regexp> matches? ] unit-test
|
||||||
[ t ] [ "a" "a|b*|c+|d?" <regexp> matches? ] unit-test
|
[ t ] [ "a" "a|b*|c+|d?" <regexp> matches? ] unit-test
|
||||||
[ t ] [ "c" "a|b*|c+|d?" <regexp> matches? ] unit-test
|
[ t ] [ "c" "a|b*|c+|d?" <regexp> matches? ] unit-test
|
||||||
|
|
|
@ -28,7 +28,7 @@ IN: regexp
|
||||||
: match ( string regexp -- pair )
|
: match ( string regexp -- pair )
|
||||||
<dfa-traverser> do-match return-match ;
|
<dfa-traverser> do-match return-match ;
|
||||||
|
|
||||||
: match* ( string regexp -- pair )
|
: match* ( string regexp -- pair captured-groups )
|
||||||
<dfa-traverser> do-match [ return-match ] [ captured-groups>> ] bi ;
|
<dfa-traverser> do-match [ return-match ] [ captured-groups>> ] bi ;
|
||||||
|
|
||||||
: matches? ( string regexp -- ? )
|
: matches? ( string regexp -- ? )
|
||||||
|
@ -129,8 +129,6 @@ IN: regexp
|
||||||
: option? ( option regexp -- ? )
|
: option? ( option regexp -- ? )
|
||||||
options>> key? ;
|
options>> key? ;
|
||||||
|
|
||||||
USE: multiline
|
|
||||||
/*
|
|
||||||
M: regexp pprint*
|
M: regexp pprint*
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
|
@ -139,4 +137,3 @@ M: regexp pprint*
|
||||||
case-insensitive swap option? [ "i" % ] when
|
case-insensitive swap option? [ "i" % ] when
|
||||||
] "" make
|
] "" make
|
||||||
] keep present-text ;
|
] keep present-text ;
|
||||||
*/
|
|
||||||
|
|
Loading…
Reference in New Issue