From 56fdc8b669088c0cef1faf690c9b682b91f2a784 Mon Sep 17 00:00:00 2001 From: uttarayan21 Date: Tue, 25 Jun 2024 03:21:54 +0530 Subject: [PATCH] feat: added more tests --- src/parser.rs | 91 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 55 insertions(+), 36 deletions(-) diff --git a/src/parser.rs b/src/parser.rs index 72f133a..a8713ba 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -160,7 +160,7 @@ fn line_fast(style: Style) -> impl Fn(&[u8]) -> IResult<&[u8], (Line<'_>, Style) fn span(last: Style) -> impl Fn(&[u8]) -> IResult<&[u8], Span<'static>, nom::error::Error<&[u8]>> { move |s: &[u8]| -> IResult<&[u8], Span<'static>> { let mut last = last; - let (s, style) = opt(style_fast(last))(s)?; + let (s, style) = opt(style(last))(s)?; #[cfg(feature = "simd")] let (s, text) = map_res(take_while(|c| c != b'\x1b' | b'\n'), |t| { @@ -184,7 +184,7 @@ fn span(last: Style) -> impl Fn(&[u8]) -> IResult<&[u8], Span<'static>, nom::err fn span_fast(last: Style) -> impl Fn(&[u8]) -> IResult<&[u8], Span<'_>, nom::error::Error<&[u8]>> { move |s: &[u8]| -> IResult<&[u8], Span<'_>> { let mut last = last; - let (s, style) = opt(style_fast(last))(s)?; + let (s, style) = opt(style(last))(s)?; #[cfg(feature = "simd")] let (s, text) = map_res(take_while(|c| c != b'\x1b' | b'\n'), |t| { @@ -204,29 +204,11 @@ fn span_fast(last: Style) -> impl Fn(&[u8]) -> IResult<&[u8], Span<'_>, nom::err } } -// fn style( -// style: Style, -// ) -> impl Fn(&[u8]) -> IResult<&[u8], Option