Skip to content

Commit

Permalink
Merge pull request #447 from katef/sv/reject-unsupported-pcre-extensi…
Browse files Browse the repository at this point in the history
…ons-during-ast-analysis

Add error code for unsupported PCRE cases (RE_EUNSUPPPCRE), reject one.
  • Loading branch information
katef authored Jan 11, 2024
2 parents 259d507 + f5b1300 commit fdd18f4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/libre/ast_analysis.c
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,8 @@ can_consume_single_newline(struct ast_expr *n)
return n->u.range.from.u.codepoint.u <= '\n'
&& n->u.range.to.u.codepoint.u >= '\n';
} else if (n->u.range.from.type == AST_ENDPOINT_NAMED) {
/* TODO: unreachable? */
/* currently unreachable, named ranges are unsupported */
assert(!"unreachable");
break;
}
break;
Expand Down Expand Up @@ -1130,6 +1131,10 @@ analysis_iter_anchoring(struct anchoring_env *env, struct ast_expr *n)
n->u.repeat.max = 1;
}

if (can_consume_single_newline(n->u.repeat.e)) {
set_flags(n, AST_FLAG_MATCHES_1NEWLINE);
}

if (n->u.repeat.e->flags & AST_FLAG_ANCHORED_END && n->u.repeat.min > 0) {
LOG(3 - LOG_ANCHORING,
"%s: REPEAT: repeating ANCHORED_END subtree >0 times -> ANCHORED_END\n", __func__);
Expand Down

0 comments on commit fdd18f4

Please sign in to comment.