MCPcopy Create free account
hub / github.com/boostorg/build / balance_parentheses

Function balance_parentheses

v2/engine/function.c:2163–2195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2161 */
2162
2163void balance_parentheses( char const * * s_, char const * * string,
2164 VAR_PARSE_GROUP * out)
2165{
2166 int depth = 1;
2167 char const * s = *s_;
2168 for ( ; ; )
2169 {
2170 if ( try_parse_variable( &s, string, out ) ) { }
2171 else if ( s[ 0 ] == ':' || s[ 0 ] == '[' )
2172 {
2173 parse_error( "unbalanced parentheses" );
2174 ++s;
2175 }
2176 else if ( s[ 0 ] == '\0' )
2177 {
2178 parse_error( "unbalanced parentheses" );
2179 break;
2180 }
2181 else if ( s[ 0 ] == ')' )
2182 {
2183 ++s;
2184 if ( --depth == 0 ) break;
2185 }
2186 else if ( s[ 0 ] == '(' )
2187 {
2188 ++depth;
2189 ++s;
2190 }
2191 else
2192 ++s;
2193 }
2194 *s_ = s;
2195}
2196
2197
2198/*

Callers 1

parse_variableFunction · 0.85

Calls 2

try_parse_variableFunction · 0.85
parse_errorFunction · 0.85

Tested by

no test coverage detected