diff --git a/src/libre/ast_analysis.c b/src/libre/ast_analysis.c index bc5bc6bed..24db8b6d7 100644 --- a/src/libre/ast_analysis.c +++ b/src/libre/ast_analysis.c @@ -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; @@ -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__);