Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add error code for unsupported PCRE cases (RE_EUNSUPPPCRE), reject one. #447

Merged
merged 4 commits into from
Jan 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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