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

Function parse_subscript

src/engine/function.cpp:950–1004  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

948 */
949
950subscript_t parse_subscript( char const * s )
951{
952 subscript_t result;
953 result.sub1 = 0;
954 result.sub2 = 0;
955 do /* so we can use "break" */
956 {
957 /* Allow negative subscripts. */
958 if ( !isdigit( *s ) && ( *s != '-' ) )
959 {
960 result.sub2 = 0;
961 break;
962 }
963 result.sub1 = atoi( s );
964
965 /* Skip over the first symbol, which is either a digit or dash. */
966 ++s;
967 while ( isdigit( *s ) ) ++s;
968
969 if ( *s == '\0' )
970 {
971 result.sub2 = result.sub1;
972 break;
973 }
974
975 if ( *s != '-' )
976 {
977 result.sub2 = 0;
978 break;
979 }
980
981 ++s;
982
983 if ( *s == '\0' )
984 {
985 result.sub2 = -1;
986 break;
987 }
988
989 if ( !isdigit( *s ) && ( *s != '-' ) )
990 {
991 result.sub2 = 0;
992 break;
993 }
994
995 /* First, compute the index of the last element. */
996 result.sub2 = atoi( s );
997 while ( isdigit( *++s ) );
998
999 if ( *s != '\0' )
1000 result.sub2 = 0;
1001
1002 } while ( 0 );
1003 return result;
1004}
1005
1006static LIST * apply_subscript( STACK * s )
1007{

Callers 2

apply_subscriptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected