feat(testing-framework): allow exclamation mark (#364)

While exclamation mark is legacy feature in the lambda parser, people
seem to use it anyway, getting errors not always easy to understand.
This commit is contained in:
Ivan Boldyrev 2022-10-11 17:52:49 +03:00 committed by GitHub
parent bf8aee7f15
commit 651b569a13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -125,7 +125,10 @@ fn parse_sexp_symbol(inp: Input<'_>) -> IResult<Input<'_>, Sexp, ParseError<'_>>
map(
recognize(pair(
many1_count(alt((value((), alphanumeric1), value((), one_of("_-.$#%"))))),
opt(delimited(tag("["), parse_sexp_symbol, tag("]"))),
opt(terminated(
delimited(tag("["), parse_sexp_symbol, tag("]")),
opt(tag("!")),
)),
)),
Sexp::symbol,
)(inp)
@ -333,6 +336,12 @@ mod tests {
assert_eq!(res, Ok(Sexp::symbol("sym_bol.$.blabla")));
}
#[test]
fn test_symbol_lambda_exclamation() {
let res = Sexp::from_str("pid-num.$.[0]!");
assert_eq!(res, Ok(Sexp::symbol("pid-num.$.[0]!")));
}
#[test]
fn test_symbol_stream() {
let res = Sexp::from_str("$stream");