mirror of
https://github.com/boostorg/build.git
synced 2026-02-14 00:32:11 +00:00
Merge remote-tracking branch 'origin/develop' into feature/cxx
This commit is contained in:
@@ -1042,7 +1042,7 @@ local rule try-one-generator-really ( project name ? : generator : target-type
|
||||
generators.dout [ indent ] " " $(targets) ;
|
||||
if $(usage-requirements)
|
||||
{
|
||||
generators.dout [ indent ] " with usage requirements:" $(x) ;
|
||||
generators.dout [ indent ] " with usage requirements:" $(usage-requirements) ;
|
||||
}
|
||||
|
||||
if $(success)
|
||||
|
||||
@@ -37,7 +37,7 @@ LIST * regex_split( FRAME * frame, int flags )
|
||||
OBJECT * s;
|
||||
OBJECT * separator;
|
||||
regexp * re;
|
||||
const char * pos;
|
||||
const char * pos, * prev;
|
||||
LIST * result = L0;
|
||||
LISTITER iter = list_begin( args );
|
||||
s = list_item( iter );
|
||||
@@ -45,11 +45,18 @@ LIST * regex_split( FRAME * frame, int flags )
|
||||
|
||||
re = regex_compile( separator );
|
||||
|
||||
pos = object_str( s );
|
||||
prev = pos = object_str( s );
|
||||
while ( regexec( re, pos ) )
|
||||
{
|
||||
result = list_push_back( result, object_new_range( pos, re->startp[ 0 ] - pos ) );
|
||||
pos = re->endp[ 0 ];
|
||||
result = list_push_back( result, object_new_range( prev, re->startp[ 0 ] - prev ) );
|
||||
prev = re->endp[ 0 ];
|
||||
/* Handle empty matches */
|
||||
if ( *pos == '\0' )
|
||||
break;
|
||||
else if ( pos == re->endp[ 0 ] )
|
||||
pos++;
|
||||
else
|
||||
pos = re->endp[ 0 ];
|
||||
}
|
||||
|
||||
result = list_push_back( result, object_new( pos ) );
|
||||
@@ -108,7 +115,13 @@ LIST * regex_replace( FRAME * frame, int flags )
|
||||
{
|
||||
string_append_range( buf, pos, re->startp[ 0 ] );
|
||||
string_append( buf, object_str( replacement ) );
|
||||
pos = re->endp[ 0 ];
|
||||
/* Handle empty matches */
|
||||
if ( *pos == '\0' )
|
||||
break;
|
||||
else if ( pos == re->endp[ 0 ] )
|
||||
string_push_back( buf, *pos++ );
|
||||
else
|
||||
pos = re->endp[ 0 ];
|
||||
}
|
||||
string_append( buf, pos );
|
||||
|
||||
|
||||
@@ -172,6 +172,8 @@ rule __test__ ( )
|
||||
assert.result "" a "" b c : split "/a//b/c" / ;
|
||||
assert.result "" a "" b c "" : split "/a//b/c/" / ;
|
||||
assert.result "" a "" b c "" "" : split "/a//b/c//" / ;
|
||||
assert.result "" a b c "" : split "abc" "" ;
|
||||
assert.result "" "" : split "" "" ;
|
||||
|
||||
assert.result a c b d
|
||||
: match (.)(.)(.)(.) : abcd : 1 3 2 4 ;
|
||||
@@ -198,6 +200,9 @@ rule __test__ ( )
|
||||
assert.result " string string" : replace " string string" " " " " ;
|
||||
assert.result "string string" : replace "string string" " " " " ;
|
||||
assert.result "-" : replace "&" "&" "-" ;
|
||||
assert.result "x" : replace "" "" "x" ;
|
||||
assert.result "xax" : replace "a" "" "x" ;
|
||||
assert.result "xaxbx" : replace "ab" "" "x" ;
|
||||
|
||||
assert.result "-" "a-b" : replace-list "&" "a&b" : "&" : "-" ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user