contrib/mdocml/mandoc.c
static int
numescape(const char *start)
{
	int		 i;
	size_t		 sz;
	const char	*cp;

	i = 0;

	/* The expression consists of a subexpression. */

	if ('\\' == start[i]) {
		cp = &start[++i];
		/*
		 * Read past the end of the subexpression.
		 * Bail immediately on errors.
		 */
		if (ESCAPE_ERROR == mandoc_escape(&cp, NULL, NULL))
			return(-1);
		return(i + cp - &start[i]);
	} 

	if ('(' != start[i++])
		return(0);

	/*
	 * A parenthesised subexpression.  Read until the closing
	 * parenthesis, making sure to handle any nested subexpressions
	 * that might ruin our parse.
	 */

	while (')' != start[i]) {
		sz = strcspn(&start[i], ")\\");
		i += (int)sz;

		if ('\0' == start[i])
			return(-1);
		else if ('\\' != start[i])
			continue;

		cp = &start[++i];
		if (ESCAPE_ERROR == mandoc_escape(&cp, NULL, NULL))
			return(-1);
		i += cp - &start[i];
	}

	/* Read past the terminating ')'. */
	return(++i);
}
/*
 * Pass over recursive numerical expressions.  This context of this
 * function is important: it's only called within character-terminating
 * escapes (e.g., \s[xxxyyy]), so all we need to do is handle initial
 * recursion: we don't care about what's in these blocks. 
 * This returns the number of characters skipped or -1 if an error
 * occurs (the caller should bail).
 */
Pass over recursive numerical expressions.  This context of this
function is important: it's only called within character-terminating
escapes , so all we need to do is handle initial
recursion: we don't care about what's in these blocks.
This returns the number of characters skipped or -1 if an error
occurs (the caller should bail).
Pass over recursive numerical expressions . This context of this function is important : it ' s only called within character - terminating escapes so all we need to do is handle initial recursion : we don ' t care about what ' s in these blocks . This returns the number of characters skipped or - 1 if an error occurs ( the caller should bail ) .
static int
numescape(const char *start)
{
	int		 i;
	size_t		 sz;
	const char	*cp;
	i = 0;
	if ('\\' == start[i]) {
		cp = &start[++i];
		if (ESCAPE_ERROR == mandoc_escape(&cp, NULL, NULL))
			return(-1);
		return(i + cp - &start[i]);
	} 
	if ('(' != start[i++])
		return(0);
	while (')' != start[i]) {
		sz = strcspn(&start[i], ")\\");
		i += (int)sz;
		if ('\0' == start[i])
			return(-1);
		else if ('\\' != start[i])
			continue;
		cp = &start[++i];
		if (ESCAPE_ERROR == mandoc_escape(&cp, NULL, NULL))
			return(-1);
		i += cp - &start[i];
	}
	return(++i);
}
static int numescape ( const char * start ) { int i ; size_t sz ; const char * cp ; i = 0 ; if ( ' \\ ' == start [ i ] ) { cp = & start [ ++ i ] ; if ( ESCAPE_ERROR == mandoc_escape ( & cp , NULL , NULL ) ) return ( -1 ) ; return ( i + cp - & start [ i ] ) ; } if ( ' ' != start [ i ++ ] ) return ( 0 ) ; while ( ' ' != start [ i ] ) { sz = strcspn ( & start [ i ] , " \\ " ) ; i += ( int ) sz ; if ( ' \0 ' == start [ i ] ) return ( -1 ) ; else if ( ' \\ ' != start [ i ] ) continue ; cp = & start [ ++ i ] ; if ( ESCAPE_ERROR == mandoc_escape ( & cp , NULL , NULL ) ) return ( -1 ) ; i += cp - & start [ i ] ; } return ( ++ i ) ; }
Pass over recursive numerical expressions.
Pass over recursive numerical expressions .
/* The expression consists of a subexpression. */ /*
		 * Read past the end of the subexpression.
		 * Bail immediately on errors.
		 */ /*
	 * A parenthesised subexpression.  Read until the closing
	 * parenthesis, making sure to handle any nested subexpressions
	 * that might ruin our parse.
	 */ /* Read past the terminating ')'. */