Skip to content

Commit 9bef86c

Browse files
committed
Catch malformed invocation input
1 parent 23e068c commit 9bef86c

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/parsing/parser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2230,7 +2230,7 @@ fn is_procedure_title(content: &str) -> bool {
22302230
// I'm not sure about anchoring this one on start and end, seeing as how it
22312231
// will be used when scanning.
22322232
fn is_invocation(content: &str) -> bool {
2233-
let re = regex!(r"^\s*(<.+?>\s*(?:\(.*?\))?)\s*$");
2233+
let re = regex!(r"^\s*<");
22342234

22352235
re.is_match(content)
22362236
}

tests/parsing/errors.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,4 +238,17 @@ making_coffee :
238238
ParsingError::ExpectedMatchingChar(43, "a function call", '(', ')'),
239239
);
240240
}
241+
242+
#[test]
243+
fn invalid_invocation_in_repeat() {
244+
expect_error(
245+
r#"
246+
making_coffee :
247+
248+
1. { repeat <making_coffee }
249+
"#
250+
.trim_ascii(),
251+
ParsingError::ExpectedMatchingChar(29, "an invocation", '<', '>'),
252+
);
253+
}
241254
}

0 commit comments

Comments
 (0)