}
case PARSE_UNION:
- if (!*ctx->re)
- break;
switch (*ctx->re)
{
case CHAR_PIPE:
case PARSE_POSTFIX:
/* Parse postfix operators. */
- if (!*ctx->re)
- break;
switch (*ctx->re)
{
case CHAR_PLUS:
an empty set of `()', a bracket expression, `.', `^', `$',
a `\' followed by a character, or a single character. */
- /* End of regexp? (empty string). */
- if (!*ctx->re)
- goto parse_literal;
-
switch (*ctx->re)
{
case CHAR_LPAREN: /* parenthesized subexpression */
ctx->re++;
goto lparen;
}
- if (!(ctx->cflags & REG_EXTENDED) && *(ctx->re + 1) == CHAR_LPAREN)
+ if (!(ctx->cflags & REG_EXTENDED) && *(ctx->re + 1) == CHAR_RPAREN)
{
goto empty_atom;
}
}
}
- if (!*ctx->re)
+ if (!ctx->re[1])
/* Trailing backslash. */
return REG_EESCAPE;
if (ctx->cflags & REG_EXTENDED
|| ctx->re == ctx->re_start)
{
+ if (!(ctx->cflags & REG_EXTENDED))
+ STACK_PUSHX(stack, int, PARSE_CATENATION);
result = tre_ast_new_literal(ctx->mem, ASSERTION,
ASSERT_AT_BOL, -1);
if (result == NULL)
if (!(ctx->cflags & REG_EXTENDED))
goto parse_literal;
+ case 0:
empty_atom:
result = tre_ast_new_literal(ctx->mem, EMPTY, -1, -1);
if (!result)
int
-regcomp(regex_t *preg, const char *regex, int cflags)
+regcomp(regex_t *restrict preg, const char *restrict regex, int cflags)
{
tre_stack_t *stack;
tre_ast_node_t *tree, *tmp_ast_l, *tmp_ast_r;