pcre: pcre-config throws bad-option on error
parent
390838d21e
commit
175b00797c
|
@ -75,33 +75,6 @@ ENUM: PCRE_ERRORS
|
|||
{ PCRE_ERROR_BADOFFSET -24 }
|
||||
{ PCRE_ERROR_SHORTUTF8 -25 } ;
|
||||
|
||||
CONSTANT: PCRE_ERROR_NOMATCH -1
|
||||
CONSTANT: PCRE_ERROR_NULL -2
|
||||
CONSTANT: PCRE_ERROR_BADOPTION -3
|
||||
CONSTANT: PCRE_ERROR_BADMAGIC -4
|
||||
CONSTANT: PCRE_ERROR_UNKNOWN_OPCODE -5
|
||||
CONSTANT: PCRE_ERROR_UNKNOWN_NODE -5
|
||||
CONSTANT: PCRE_ERROR_NOMEMORY -6
|
||||
CONSTANT: PCRE_ERROR_NOSUBSTRING -7
|
||||
CONSTANT: PCRE_ERROR_MATCHLIMIT -8
|
||||
CONSTANT: PCRE_ERROR_CALLOUT -9
|
||||
CONSTANT: PCRE_ERROR_BADUTF8 -10
|
||||
CONSTANT: PCRE_ERROR_BADUTF8_OFFSET -11
|
||||
CONSTANT: PCRE_ERROR_PARTIAL -12
|
||||
CONSTANT: PCRE_ERROR_BADPARTIAL -13
|
||||
CONSTANT: PCRE_ERROR_INTERNAL -14
|
||||
CONSTANT: PCRE_ERROR_BADCOUNT -15
|
||||
CONSTANT: PCRE_ERROR_DFA_UITEM -16
|
||||
CONSTANT: PCRE_ERROR_DFA_UCOND -17
|
||||
CONSTANT: PCRE_ERROR_DFA_UMLIMIT -18
|
||||
CONSTANT: PCRE_ERROR_DFA_WSSIZE -19
|
||||
CONSTANT: PCRE_ERROR_DFA_RECURSE -20
|
||||
CONSTANT: PCRE_ERROR_RECURSIONLIMIT -21
|
||||
CONSTANT: PCRE_ERROR_NULLWSLIMIT -22
|
||||
CONSTANT: PCRE_ERROR_BADNEWLINE -23
|
||||
CONSTANT: PCRE_ERROR_BADOFFSET -24
|
||||
CONSTANT: PCRE_ERROR_SHORTUTF8 -25
|
||||
|
||||
CONSTANT: PCRE_INFO_OPTIONS 0
|
||||
CONSTANT: PCRE_INFO_SIZE 1
|
||||
CONSTANT: PCRE_INFO_CAPTURECOUNT 2
|
||||
|
@ -144,7 +117,7 @@ STRUCT: pcre_extra
|
|||
{ mark uchar** }
|
||||
{ executable_jit void* } ;
|
||||
|
||||
FUNCTION: void pcre_config ( int what, void* where ) ;
|
||||
FUNCTION: int pcre_config ( int what, void* where ) ;
|
||||
|
||||
FUNCTION: void* pcre_compile ( c-string pattern,
|
||||
int options,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
USING: accessors arrays assocs http.client kernel math.ranges
|
||||
pcre pcre.ffi pcre.private random sequences system tools.test ;
|
||||
USING: accessors arrays assocs continuations http.client kernel
|
||||
literals math.ranges pcre pcre.ffi pcre.private random sequences
|
||||
system tools.test ;
|
||||
QUALIFIED: regexp
|
||||
IN: pcre.tests
|
||||
|
||||
|
@ -34,9 +35,16 @@ os unix? [ [ 10 ] [ PCRE_CONFIG_NEWLINE pcre-config ] unit-test ] when
|
|||
|
||||
[ 1 ] [ PCRE_CONFIG_UNICODE_PROPERTIES pcre-config ] unit-test
|
||||
|
||||
! libpcre must not support 16 or 32 bit code points.
|
||||
[ 0 ] [ PCRE_CONFIG_UTF16 pcre-config ] unit-test
|
||||
[ 0 ] [ PCRE_CONFIG_UTF32 pcre-config ] unit-test
|
||||
! Ok if these options throw if the pcre library is to old to support
|
||||
! these configuration parameters.
|
||||
[ t ] [
|
||||
[ PCRE_CONFIG_UTF16 pcre-config ] [ what>> ] recover
|
||||
{ 0 $ PCRE_CONFIG_UTF16 } member?
|
||||
] unit-test
|
||||
[ t ] [
|
||||
[ PCRE_CONFIG_UTF32 pcre-config ] [ what>> ] recover
|
||||
{ 0 $ PCRE_CONFIG_UTF32 } member?
|
||||
] unit-test
|
||||
|
||||
! Tests for findall
|
||||
[
|
||||
|
|
|
@ -8,6 +8,8 @@ math.bitwise pcre.ffi sequences splitting strings ;
|
|||
QUALIFIED: regexp
|
||||
IN: pcre
|
||||
|
||||
ERROR: bad-option what ;
|
||||
|
||||
ERROR: malformed-regexp expr error ;
|
||||
|
||||
ERROR: pcre-error value ;
|
||||
|
@ -32,14 +34,8 @@ ERROR: pcre-error value ;
|
|||
] [ 2drop f ] if* ;
|
||||
|
||||
: pcre-config ( what -- value )
|
||||
dup {
|
||||
PCRE_CONFIG_MATCH_LIMIT
|
||||
PCRE_CONFIG_MATCH_LIMIT_RECURSION
|
||||
} member? [
|
||||
{ long } [ pcre_config ] with-out-parameters
|
||||
] [
|
||||
{ int } [ pcre_config ] with-out-parameters
|
||||
] if dup PCRE_ERROR_BADOPTION = [ pcre-error ] when ;
|
||||
[ { long } [ pcre_config ] with-out-parameters ] keep
|
||||
rot 0 = [ drop ] [ bad-option ] if ;
|
||||
|
||||
: pcre-fullinfo ( pcre extra what -- obj )
|
||||
{ int } [ pcre_fullinfo ] with-out-parameters nip ;
|
||||
|
@ -59,7 +55,7 @@ ERROR: pcre-error value ;
|
|||
|
||||
: name-table-entry ( addr -- group-index group-name )
|
||||
[ <alien> 1 alien-unsigned-1 ]
|
||||
[ 2 + <alien> utf8 alien>string ] bi ;
|
||||
[ 2 + <alien> utf8 alien>string ] bi ;
|
||||
|
||||
: name-table-entries ( pcre extra -- addrs )
|
||||
[ name-table ] [ name-entry-size ] [ name-count ] 2tri
|
||||
|
|
Loading…
Reference in New Issue