From 8dc7accbec1aaf73ac3d34a0f659e7e361e612ad Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Mon, 1 Oct 2018 03:25:47 +0200 Subject: Revert "Add and escapes for action (WIP)" This reverts commit 5ef2443642a2d8b223afdf169200a725d2809b76. See that commit for details. --- src/parser.rs | 56 +------------------------------------------------------- 1 file changed, 1 insertion(+), 55 deletions(-) (limited to 'src') diff --git a/src/parser.rs b/src/parser.rs index 4b1f83e..a84aba1 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -257,11 +257,7 @@ where )), try(( many1(key_modifier()), - choice!( - try(string_case_insensitive("Bslash")).map(|_| '\\'), - try(string_case_insensitive("lt")).map(|_| '<'), - try(action_character().and(satisfy(|c| c != '>'))) - ).map(|c| + action_character().map(|c| KeyboardKey::Character(Character::new(c)) ), )) @@ -878,56 +874,6 @@ mod tests { assert_eq!(result, Ok(expected)); } - #[test] - fn action_parses_map_with_bslash_and_lt_special_keys() { - let text = "aAND>"; - - let expected = Action::Map(vec![ - KeyboardKeyWithModifiers::new( - KeyboardKey::Character(Character::new('a')), - None, - ), - KeyboardKeyWithModifiers::new( - KeyboardKey::Character(Character::new('\\')), - None, - ), - KeyboardKeyWithModifiers::new( - KeyboardKey::Character(Character::new('A')), - None, - ), - KeyboardKeyWithModifiers::new( - KeyboardKey::Character(Character::new('N')), - None, - ), - KeyboardKeyWithModifiers::new( - KeyboardKey::Character(Character::new('D')), - None, - ), - KeyboardKeyWithModifiers::new( - KeyboardKey::Character(Character::new('<')), - None, - ), - KeyboardKeyWithModifiers::new( - KeyboardKey::Character(Character::new('>')), - None, - ), - KeyboardKeyWithModifiers::new( - KeyboardKey::Character(Character::new('\\')), - Some(vec![Flag::Control]), - ), - KeyboardKeyWithModifiers::new( - KeyboardKey::Character(Character::new('<')), - Some(vec![ - Flag::Meta, - Flag::Shift, - ]), - ), - ]); - let result = action_map().easy_parse(text).map(|t| t.0); - - assert_eq!(result, Ok(expected)); - } - #[test] fn action_parses_command_to_vec_of_words() { let text = "/usr/bin/say 'hello'"; -- cgit v1.2.3