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

Function regdump

src/engine/regexp.cpp:1173–1210  ·  view source on GitHub ↗

- regdump - dump a regexp onto stdout in vaguely comprehensible form */

Source from the content-addressed store, hash-verified

1171 - regdump - dump a regexp onto stdout in vaguely comprehensible form
1172 */
1173void
1174regdump( regexp *r )
1175{
1176 char *s;
1177 char op = EXACTLY; /* Arbitrary non-END op. */
1178 char *next;
1179
1180
1181 s = r->program + 1;
1182 while (op != END) { /* While that wasn't END last time... */
1183 op = OP(s);
1184 out_printf("%2d%s", s-r->program, regprop(s)); /* Where, what. */
1185 next = regnext(s);
1186 if (next == NULL) /* Next ptr. */
1187 out_printf("(0)");
1188 else
1189 out_printf("(%d)", (s-r->program)+(next-s));
1190 s += 3;
1191 if (op == ANYOF || op == ANYBUT || op == EXACTLY) {
1192 /* Literal string, where present. */
1193 while (*s != '\0') {
1194 out_putc(*s);
1195 s++;
1196 }
1197 s++;
1198 }
1199 out_putc('\n');
1200 }
1201
1202 /* Header fields of interest. */
1203 if (r->regstart != '\0')
1204 out_printf("start `%c' ", r->regstart);
1205 if (r->reganch)
1206 out_printf("anchored ");
1207 if (r->regmust != NULL)
1208 out_printf("must have \"%s\"", r->regmust);
1209 out_printf("\n");
1210}
1211
1212/*
1213 - regprop - printable representation of opcode

Callers

nothing calls this directly

Calls 4

out_printfFunction · 0.85
regpropFunction · 0.85
regnextFunction · 0.85
out_putcFunction · 0.85

Tested by

no test coverage detected