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

Function parse_variable

src/engine/function.c:2046–2151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2044 */
2045
2046static VAR_PARSE * parse_variable( char const * * string )
2047{
2048 VAR_PARSE_VAR * const result = var_parse_var_new();
2049 VAR_PARSE_GROUP * const name = result->name;
2050 char const * s = *string;
2051 for ( ; ; )
2052 {
2053 if ( try_parse_variable( &s, string, name ) ) {}
2054 else if ( s[ 0 ] == ':' )
2055 {
2056 VAR_PARSE_GROUP * mod;
2057 var_parse_group_maybe_add_constant( name, *string, s );
2058 ++s;
2059 *string = s;
2060 mod = var_parse_var_new_modifier( result );
2061 for ( ; ; )
2062 {
2063 if ( try_parse_variable( &s, string, mod ) ) {}
2064 else if ( s[ 0 ] == ')' )
2065 {
2066 var_parse_group_maybe_add_constant( mod, *string, s );
2067 *string = ++s;
2068 return (VAR_PARSE *)result;
2069 }
2070 else if ( s[ 0 ] == '(' )
2071 {
2072 ++s;
2073 balance_parentheses( &s, string, mod );
2074 }
2075 else if ( s[ 0 ] == ':' )
2076 {
2077 var_parse_group_maybe_add_constant( mod, *string, s );
2078 *string = ++s;
2079 mod = var_parse_var_new_modifier( result );
2080 }
2081 else if ( s[ 0 ] == '[' )
2082 {
2083 parse_error("unexpected subscript");
2084 ++s;
2085 }
2086 else if ( s[ 0 ] == '\0' )
2087 {
2088 parse_error( "unbalanced parentheses" );
2089 var_parse_group_maybe_add_constant( mod, *string, s );
2090 *string = s;
2091 return (VAR_PARSE *)result;
2092 }
2093 else
2094 ++s;
2095 }
2096 }
2097 else if ( s[ 0 ] == '[' )
2098 {
2099 VAR_PARSE_GROUP * subscript = var_parse_group_new();
2100 result->subscript = subscript;
2101 var_parse_group_maybe_add_constant( name, *string, s );
2102 *string = ++s;
2103 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