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

Function regrepeat

v2/engine/regexp.c:1102–1142  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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