From ba070578e48e1fab70075853638141502ba1615a Mon Sep 17 00:00:00 2001 From: El-BG-1970 Date: Fri, 29 Apr 2022 20:02:21 +0200 Subject: better handling --- src/parser.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/parser.rs') diff --git a/src/parser.rs b/src/parser.rs index 4b78944..b95e619 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -25,10 +25,10 @@ fn parameter(i: &str) -> IResult<&str, &str> { alphanumeric1(i) } -fn ligature(i: &str) -> IResult<&str, char> { +fn ligature(i: &str) -> IResult<&str, Option> { match tag(";")(i) { Ok((rest, c)) => - Ok((rest, c.chars().nth(0).unwrap())), + Ok((rest, c.chars().nth(0))), Err(e) => Err(e) } } @@ -44,6 +44,6 @@ fn command_line(i: &str) -> IResult<&str, Vec> { } } -fn command_string(i: &str) -> IResult<&str, Vec<(Vec,char)>> { +fn command_lines(i: &str) -> IResult<&str, Vec<(Vec,Option)>> { many1(tuple((command_line, ligature)))(i) } -- cgit v1.2.3