diff options
Diffstat (limited to 'src/parser.rs')
| -rw-r--r-- | src/parser.rs | 11 | 
1 files changed, 11 insertions, 0 deletions
| diff --git a/src/parser.rs b/src/parser.rs index e30c5f4..a34edff 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -1,6 +1,7 @@  use std::collections::HashMap;  use combine::*; +use combine::easy::Errors as CombineErrors;  use combine::parser::choice::or;  use combine::parser::char::{      newline, @@ -10,6 +11,7 @@ use combine::parser::char::{      tab,  };  use combine::parser::repeat::take_until; +use combine::stream::state::{SourcePosition, State};  #[derive(Debug, Hash, Eq, PartialEq)]  pub enum HeadphoneButton { @@ -59,6 +61,15 @@ enum Definition {      Mode(Mode),  } +impl MapGroup { +    pub fn parse( +        mappings: &str +    ) -> Result<MapGroup, CombineErrors<char, &str, SourcePosition>> { +        let input = State::new(mappings); +        map_group().easy_parse(input).map(|t| t.0) +    } +} +  fn map_kind<I>() -> impl Parser<Input = I, Output = MapKind>  where | 
