add support for [\\w] and [\\W]
parent
cba8f2a860
commit
49af5a1ac0
|
@ -30,6 +30,10 @@ M: ascii-class class-member? ( obj class -- ? )
|
|||
M: digit-class class-member? ( obj class -- ? )
|
||||
drop digit? ;
|
||||
|
||||
M: c-identifier-class class-member? ( obj class -- ? )
|
||||
drop
|
||||
{ [ digit? ] [ Letter? ] [ CHAR: _ = ] } 1|| ;
|
||||
|
||||
M: alpha-class class-member? ( obj class -- ? )
|
||||
drop alpha? ;
|
||||
|
||||
|
|
|
@ -46,6 +46,14 @@ IN: regexp-tests
|
|||
[ t ] [ "a" ".+" <regexp> matches? ] unit-test
|
||||
[ t ] [ "ab" ".+" <regexp> matches? ] unit-test
|
||||
|
||||
[ t ] [ " " "[\\s]" <regexp> matches? ] unit-test
|
||||
[ f ] [ "a" "[\\s]" <regexp> matches? ] unit-test
|
||||
[ f ] [ " " "[\\S]" <regexp> matches? ] unit-test
|
||||
[ t ] [ "a" "[\\S]" <regexp> matches? ] unit-test
|
||||
[ f ] [ " " "[\\w]" <regexp> matches? ] unit-test
|
||||
[ t ] [ "a" "[\\w]" <regexp> matches? ] unit-test
|
||||
[ t ] [ " " "[\\W]" <regexp> matches? ] unit-test
|
||||
[ f ] [ "a" "[\\W]" <regexp> matches? ] unit-test
|
||||
|
||||
[ t ] [ "" "a|b*|c+|d?" <regexp> matches? ] unit-test
|
||||
[ t ] [ "a" "a|b*|c+|d?" <regexp> matches? ] unit-test
|
||||
|
|
Loading…
Reference in New Issue