diff --git a/src/lenient_parse/internal/parser.gleam b/src/lenient_parse/internal/parser.gleam index e79a687..0e4b09c 100644 --- a/src/lenient_parse/internal/parser.gleam +++ b/src/lenient_parse/internal/parser.gleam @@ -292,14 +292,16 @@ fn form_base_prefix( specifier specifier: String, base base: Int, ) -> Result(ParseData(Option(#(#(Int, Int), String, Int))), ParseError) { - let new_rest = case tokens { + let #(start_index, end_index) = index_range + let rest = case tokens { [] -> [] [_, ..tokens] -> tokens } + Ok(ParseData( - data: Some(#(#(index_range.0, index_range.1 + 1), "0" <> specifier, base)), - next_index: index_range.1 + 2, - tokens: new_rest, + data: Some(#(#(start_index, end_index + 1), "0" <> specifier, base)), + next_index: end_index + 2, + tokens: rest, )) }