Skip to content

Commit

Permalink
fix: range parsing on emacs
Browse files Browse the repository at this point in the history
  • Loading branch information
rgrinberg committed Oct 26, 2024
1 parent 3d35a61 commit cfbfbe7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/emacs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ module Re = Core
exception Parse_error
exception Not_supported

let by_code f c c' =
let c = Char.code c in
let c' = Char.code c' in
Char.chr (f c c')
;;

let parse s =
let buf = Parse_buffer.create s in
let accept = Parse_buffer.accept buf in
Expand Down Expand Up @@ -105,6 +111,7 @@ let parse s =
then Re.char c :: Re.char '-' :: s
else (
let c' = char () in
let c' = by_code Int.max c c' in
bracket (Re.rg c c' :: s))
else bracket (Re.char c :: s))
and char () =
Expand Down

0 comments on commit cfbfbe7

Please sign in to comment.