From d7786b89766e607018953ea15d19dbe46802cc85 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Thu, 27 Sep 2018 00:14:33 +0200 Subject: parser: Make a new `Action` type With this new type, I'm trying to set up a way to parse actions more precisely, to allow us to get special keys and modifier-flagged keys. Still trying to work out how this is going to work at the parser level though, since the action parser is going to need to depend on the map kind parser. --- src/parser.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/parser.rs b/src/parser.rs index ea96740..57abbbb 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -1,5 +1,6 @@ use std::collections::HashMap; +use autopilot::key::{Flag, KeyCodeConvertible}; use combine::*; use combine::easy::Errors as CombineErrors; use combine::parser::choice::or; @@ -23,6 +24,11 @@ pub enum HeadphoneButton { type Trigger = Vec; type Action = String; +enum Action2<'a, T: 'a + KeyCodeConvertible> { + Map(&'a [(T, &'a [Flag])]), + Command(&'a [&'a str]), +} + #[repr(C)] #[derive(Debug, PartialEq)] pub enum MapKind { -- cgit v1.2.3