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

Function regrepeat

src/engine/regexp.cpp:1103–1143  ·  view source on GitHub ↗

- regrepeat - repeatedly match something simple, report how many */

Source from the content-addressed store, hash-verified

1101 - regrepeat - repeatedly match something simple, report how many
1102 */
1103static int32_t
1104regrepeat( char *p )
1105{
1106 int32_t count = 0;
1107 const char *scan;
1108 char *opnd;
1109
1110 scan = reginput;
1111 opnd = OPERAND(p);
1112 switch (OP(p)) {
1113 case ANY:
1114 count = int32_t(strlen(scan));
1115 scan += count;
1116 break;
1117 case EXACTLY:
1118 while (*opnd == *scan) {
1119 count++;
1120 scan++;
1121 }
1122 break;
1123 case ANYOF:
1124 while (*scan != '\0' && strchr(opnd, *scan) != NULL) {
1125 count++;
1126 scan++;
1127 }
1128 break;
1129 case ANYBUT:
1130 while (*scan != '\0' && strchr(opnd, *scan) == NULL) {
1131 count++;
1132 scan++;
1133 }
1134 break;
1135 default: /* Oh dear. Called inappropriately. */
1136 regerror("internal foulup");
1137 count = 0; /* Best compromise. */
1138 break;
1139 }
1140 reginput = scan;
1141
1142 return(count);
1143}
1144
1145/*
1146 - regnext - dig the "next" pointer out of a node

Callers 1

regmatchFunction · 0.85

Calls 1

regerrorFunction · 0.85

Tested by

no test coverage detected