From f28e74c6c28c58819cbdc69994ce17407443bbb4 Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Sun, 4 Apr 2021 16:04:51 -0600 Subject: auto-yeet spaces after comma between function arguments --- src/makefile/token.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/makefile/token.rs b/src/makefile/token.rs index 18a1773..44d8c8b 100644 --- a/src/makefile/token.rs +++ b/src/makefile/token.rs @@ -13,7 +13,10 @@ use nom::{ Finish, IResult, }; #[cfg(feature = "full")] -use nom::{character::complete::space1, multi::separated_list1}; +use nom::{ + character::complete::{space0, space1}, + multi::separated_list1, +}; trait Err<'a>: 'a + ParseError<&'a str> + ContextError<&'a str> {} impl<'a, T: 'a + ParseError<&'a str> + ContextError<&'a str>> Err<'a> for T {} @@ -210,7 +213,7 @@ fn function_call_body<'a, E: Err<'a>>( separated_pair( macro_function_name, space1, - separated_list1(tag(","), tokens_but_not(vec![',', end])), + separated_list1(pair(tag(","), space0), tokens_but_not(vec![',', end])), ), |(name, args)| Token::FunctionCall { name: name.into(), @@ -460,7 +463,7 @@ mod test { tokens, TokenString(vec![token_function_call( "foo", - vec![TokenString::text("bar"), tokenize(" $(baz)")?] + vec![TokenString::text("bar"), tokenize("$(baz)")?] )]) ); Ok(()) -- cgit v1.2.3