diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/parser.rs | 66 |
1 files changed, 53 insertions, 13 deletions
diff --git a/src/parser.rs b/src/parser.rs index 57abbbb..f034784 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -138,21 +138,61 @@ where I: Stream<Item = char>, I::Error: ParseError<I::Item, I::Range, I::Position>, { - ( - map_kind(), - whitespace_separator(), - trigger(), - whitespace_separator(), - action() - ).map(|(kind, _, trigger, _, action)| - Map { - trigger: trigger, - action: action, - kind: kind, - } - ) + // ( + // map_kind(), + // whitespace_separator(), + // trigger(), + // whitespace_separator(), + // action() + // ).map(|(kind, _, trigger, _, action)| + // Map { + // trigger: trigger, + // action: action, + // kind: kind, + // } + // ) + + // --- + take_until(newline()).flat_map(|line| { + map_kind().parse(line).map(|t| { + let map_kind = t.0; + let rest = t.1; + + ( + whitespace_separator(), + trigger(), + whitespace_separator(), + action() + ) + .map(|(_, trigger, _, action)| + Map { + trigger: trigger, + action: action, + kind: map_kind, + } + ) + .parse(rest) + + // map_kind + + // match map_kind { + // MapKind::Map => { + // }, + // MapKind::Command => { + // }, + // } + }) + }) } + +// fn real_action<I>(input: I) -> impl Parser<Input = I, Output = Action2> +// where +// I: Stream<Item = char>, +// I::Error: ParseError<I::Item, I::Range, I::Position>, +// { +// } + fn map_collection<I>() -> impl Parser<Input = I, Output = MapCollection> where I: Stream<Item = char>, |
