aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/makefile/mod.rs3
-rw-r--r--src/makefile/token.rs10
2 files changed, 4 insertions, 9 deletions
diff --git a/src/makefile/mod.rs b/src/makefile/mod.rs
index c118eb9..5be18e0 100644
--- a/src/makefile/mod.rs
+++ b/src/makefile/mod.rs
@@ -714,8 +714,7 @@ mod test {
#[test]
fn basic_conditionals() -> R {
let file = "
-ifneq (,$(foo bar, $(baz)))
-else ifeq (1,1)
+ifeq (1,1)
worked = yes
else ifeq (2,2)
worked = no
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(())