From 61409cd6bb4e2338c0ded5494b1224baa3ace324 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Fri, 25 Oct 2024 19:58:03 +0100 Subject: [PATCH] refactor: share exception with glob parser (#546) --- lib/glob.ml | 2 +- lib/parse_buffer.ml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/glob.ml b/lib/glob.ml index d4a91774..82b417b9 100644 --- a/lib/glob.ml +++ b/lib/glob.ml @@ -22,7 +22,7 @@ module Re = Core -exception Parse_error +exception Parse_error = Parse_buffer.Parse_error type enclosed = | Char of char diff --git a/lib/parse_buffer.ml b/lib/parse_buffer.ml index ebedf539..8d35d6bb 100644 --- a/lib/parse_buffer.ml +++ b/lib/parse_buffer.ml @@ -37,6 +37,7 @@ let accept_s t s' = let len = String.length s' in try for j = 0 to len - 1 do + (* CR-someday rgrinberg: stop relying on bound checks *) try if s'.[j] <> t.str.[t.pos + j] then raise_notrace Exit with | _ -> raise_notrace Exit done;