pcre: support for the regexp literal syntax from the regexp vocab
parent
0c08896981
commit
6748bc4bc7
|
@ -10,6 +10,7 @@ USING:
|
||||||
sequences
|
sequences
|
||||||
system
|
system
|
||||||
tools.test ;
|
tools.test ;
|
||||||
|
QUALIFIED: regexp
|
||||||
IN: pcre.tests
|
IN: pcre.tests
|
||||||
|
|
||||||
CONSTANT: iso-date "(?P<year>\\d{4})-(?P<month>\\d{2})-(?P<day>\\d{2})"
|
CONSTANT: iso-date "(?P<year>\\d{4})-(?P<month>\\d{2})-(?P<day>\\d{2})"
|
||||||
|
@ -117,3 +118,6 @@ os unix? [ [ 10 ] [ PCRE_CONFIG_NEWLINE config ] unit-test ] when
|
||||||
"http://factorcode.org/" http-get nip
|
"http://factorcode.org/" http-get nip
|
||||||
"href=\"(?P<link>[^\"]+)\"" findall [ "link" of ] map sequence?
|
"href=\"(?P<link>[^\"]+)\"" findall [ "link" of ] map sequence?
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
|
! Test that the regexp syntax works.
|
||||||
|
[ t ] [ "1234abcd" regexp:R[ ^\d+\w+$] matches? ] unit-test
|
||||||
|
|
|
@ -10,6 +10,7 @@ USING:
|
||||||
pcre.ffi pcre.info pcre.utils
|
pcre.ffi pcre.info pcre.utils
|
||||||
sequences sequences.generalizations
|
sequences sequences.generalizations
|
||||||
strings ;
|
strings ;
|
||||||
|
QUALIFIED: regexp
|
||||||
IN: pcre
|
IN: pcre
|
||||||
|
|
||||||
ERROR: malformed-regexp expr error ;
|
ERROR: malformed-regexp expr error ;
|
||||||
|
@ -90,6 +91,9 @@ M: compiled-pcre findall
|
||||||
M: string findall
|
M: string findall
|
||||||
<compiled-pcre> findall ;
|
<compiled-pcre> findall ;
|
||||||
|
|
||||||
|
M: regexp:regexp findall
|
||||||
|
raw>> findall ;
|
||||||
|
|
||||||
: matches? ( subject obj -- ? )
|
: matches? ( subject obj -- ? )
|
||||||
dupd findall [ nip length 1 = ] [ ?first ?first ?last = ] 2bi and ;
|
dupd findall [ nip length 1 = ] [ ?first ?first ?last = ] 2bi and ;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue