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

Function parse_variable

src/engine/function.cpp:2230–2335  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2228 */
2229
2230static VAR_PARSE * parse_variable( char const * * string )
2231{
2232 VAR_PARSE_VAR * const result = var_parse_var_new();
2233 VAR_PARSE_GROUP * const name = result->name;
2234 char const * s = *string;
2235 for ( ; ; )
2236 {
2237 if ( try_parse_variable( &s, string, name ) ) {}
2238 else if ( s[ 0 ] == ':' )
2239 {
2240 VAR_PARSE_GROUP * mod;
2241 var_parse_group_maybe_add_constant( name, *string, s );
2242 ++s;
2243 *string = s;
2244 mod = var_parse_var_new_modifier( result );
2245 for ( ; ; )
2246 {
2247 if ( try_parse_variable( &s, string, mod ) ) {}
2248 else if ( s[ 0 ] == ')' )
2249 {
2250 var_parse_group_maybe_add_constant( mod, *string, s );
2251 *string = ++s;
2252 return (VAR_PARSE *)result;
2253 }
2254 else if ( s[ 0 ] == '(' )
2255 {
2256 ++s;
2257 balance_parentheses( &s, string, mod );
2258 }
2259 else if ( s[ 0 ] == ':' )
2260 {
2261 var_parse_group_maybe_add_constant( mod, *string, s );
2262 *string = ++s;
2263 mod = var_parse_var_new_modifier( result );
2264 }
2265 else if ( s[ 0 ] == '[' )
2266 {
2267 parse_error("unexpected subscript");
2268 ++s;
2269 }
2270 else if ( s[ 0 ] == '\0' )
2271 {
2272 parse_error( "unbalanced parentheses" );
2273 var_parse_group_maybe_add_constant( mod, *string, s );
2274 *string = s;
2275 return (VAR_PARSE *)result;
2276 }
2277 else
2278 ++s;
2279 }
2280 }
2281 else if ( s[ 0 ] == '[' )
2282 {
2283 VAR_PARSE_GROUP * subscript = var_parse_group_new();
2284 result->subscript = subscript;
2285 var_parse_group_maybe_add_constant( name, *string, s );
2286 *string = ++s;
2287 for ( ; ; )

Callers 1

try_parse_variableFunction · 0.85

Calls 7

var_parse_var_newFunction · 0.85
try_parse_variableFunction · 0.85
balance_parenthesesFunction · 0.85
parse_errorFunction · 0.85
var_parse_group_newFunction · 0.85

Tested by

no test coverage detected