aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2018-09-27 00:14:33 +0200
committerTeddy Wing2018-09-27 00:14:33 +0200
commitd7786b89766e607018953ea15d19dbe46802cc85 (patch)
tree828a13eb704c85f54bf104075bb166e3d79a35e1
parenta81a24757a708bd7081431da118795976d154d4c (diff)
downloaddome-key-map-d7786b89766e607018953ea15d19dbe46802cc85.tar.bz2
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.
-rw-r--r--src/parser.rs6
1 files changed, 6 insertions, 0 deletions
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<HeadphoneButton>;
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 {