aboutsummaryrefslogtreecommitdiff
path: root/src/makefile/token.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/makefile/token.rs')
-rw-r--r--src/makefile/token.rs10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/makefile/token.rs b/src/makefile/token.rs
index 0ee3e4c..60cffe0 100644
--- a/src/makefile/token.rs
+++ b/src/makefile/token.rs
@@ -205,7 +205,7 @@ fn function_call_body<'a, E: Err<'a>>(
fn parens_macro_expansion<'a, E: Err<'a>>(input: &'a str) -> IResult<&'a str, Token, E> {
delimited(
tag("$("),
- alt((macro_expansion_body(')'), function_call_body(')'))),
+ alt((function_call_body(')'), macro_expansion_body(')'))),
tag(")"),
)(input)
}
@@ -213,7 +213,7 @@ fn parens_macro_expansion<'a, E: Err<'a>>(input: &'a str) -> IResult<&'a str, To
fn braces_macro_expansion<'a, E: Err<'a>>(input: &'a str) -> IResult<&'a str, Token, E> {
delimited(
tag("${"),
- alt((macro_expansion_body('}'), function_call_body('}'))),
+ alt((function_call_body('}'), macro_expansion_body('}'))),
tag("}"),
)(input)
}
@@ -432,17 +432,13 @@ mod test {
#[test]
fn function_hell() -> R {
- dbg!(alt::<_, _, VerboseError<_>, _>((
- macro_expansion_body(')'),
- function_call_body(')')
- ))("$(foo bar,$(baz))"));
let text = "$(foo bar, $(baz))";
let tokens = tokenize(text)?;
assert_eq!(
tokens,
TokenString(vec![token_function_call(
"foo",
- vec![TokenString::text("bar"), TokenString::r#macro("baz")]
+ vec![TokenString::text("bar"), tokenize(" $(baz)")?]
)])
);
Ok(())