diff options
author | cyqsimon <28627918+cyqsimon@users.noreply.github.com> | 2023-11-04 20:23:33 +0800 |
---|---|---|
committer | cyqsimon <28627918+cyqsimon@users.noreply.github.com> | 2023-12-11 10:20:12 +0800 |
commit | 075b5b288a9815e313154291f7289c70ac63ba52 (patch) | |
tree | 3d9fda9f3c7b06b16cce7f8bef1f686016a95f76 /build | |
parent | 7cfd1e0d7843881407ba2ddb070e1315ffd6cb5f (diff) |
Matcher parser errors when empty
Diffstat (limited to 'build')
-rw-r--r-- | build/syntax_mapping.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/build/syntax_mapping.rs b/build/syntax_mapping.rs index 73d2c04e..b8595e87 100644 --- a/build/syntax_mapping.rs +++ b/build/syntax_mapping.rs @@ -86,6 +86,10 @@ impl FromStr for Matcher { }) .collect_vec(); + if non_empty_segments.is_empty() { + bail!(r#"Parsed an empty matcher: "{s}""#); + } + if non_empty_segments.iter().any(|seg| match seg { Seg::Text(t) => t.contains(['$', '{', '}']), Seg::Env(_) => false, |