allow <> enclosing argument lists

This commit is contained in:
John Cupitt 2011-07-28 12:55:54 +01:00
parent 1fe6241a5e
commit 8cc0d033ea
2 changed files with 5 additions and 25 deletions

5
TODO
View File

@ -1,8 +1,3 @@
- various errors from gtk-doc, eg.
../xml/image.xml:182: element refsect2: validity error : ID VipsDemandStyle already defined
<refsect2 id="VipsDemandStyle" role="enum">
^
- leak check, again - leak check, again

View File

@ -1193,6 +1193,7 @@ vips__token_get( const char *p, VipsToken *token, char *string, int size )
case '{': case '{':
case '[': case '[':
case '(': case '(':
case '<':
*token = VIPS_TOKEN_LEFT; *token = VIPS_TOKEN_LEFT;
p += 1; p += 1;
break; break;
@ -1200,6 +1201,7 @@ vips__token_get( const char *p, VipsToken *token, char *string, int size )
case ')': case ')':
case ']': case ']':
case '}': case '}':
case '>':
*token = VIPS_TOKEN_RIGHT; *token = VIPS_TOKEN_RIGHT;
p += 1; p += 1;
break; break;
@ -1256,7 +1258,7 @@ vips__token_get( const char *p, VipsToken *token, char *string, int size )
* so the next break must be bracket, equals, comma. * so the next break must be bracket, equals, comma.
*/ */
*token = VIPS_TOKEN_STRING; *token = VIPS_TOKEN_STRING;
n = strcspn( p, "[{()}]=," ); n = strcspn( p, "<[{()}]>=," );
g_assert( size > n + 1 ); g_assert( size > n + 1 );
memcpy( string, p, n ); memcpy( string, p, n );
string[n] = '\0'; string[n] = '\0';
@ -1291,23 +1293,6 @@ vips__token_must( const char *p, VipsToken *token,
return( p ); return( p );
} }
/* Turn a VipsToken into a string.
*/
static const char *
vips__token_string( VipsToken token )
{
switch( token ) {
case VIPS_TOKEN_LEFT: return( _( "opening brace" ) );
case VIPS_TOKEN_RIGHT: return( _( "closing brace" ) );
case VIPS_TOKEN_STRING: return( _( "string" ) );
case VIPS_TOKEN_EQUALS: return( "=" );
case VIPS_TOKEN_COMMA: return( "," );
default:
g_assert( 0 );
}
}
/* We expect a certain token. /* We expect a certain token.
*/ */
const char * const char *
@ -1320,8 +1305,8 @@ vips__token_need( const char *p, VipsToken need_token,
return( NULL ); return( NULL );
if( token != need_token ) { if( token != need_token ) {
vips_error( "get_token", _( "expected %s, saw %s" ), vips_error( "get_token", _( "expected %s, saw %s" ),
vips__token_string( need_token ), VIPS_ENUM_NICK( VIPS_TYPE_TOKEN, need_token ),
vips__token_string( token ) ); VIPS_ENUM_NICK( VIPS_TYPE_TOKEN, token ) );
return( NULL ); return( NULL );
} }