With parsing library angstrom, this :
open Angstrom
let ab = char 'a' <|> char 'b'
parse_string ~consume:All ab "a";;
(* Ok 'a' *)
parse_string ~consume:All ab "b";;
(* Ok 'b' *)
works as I expect, but this :
open Angstrom
let ab = (many (char 'a')) <|> many (char 'b'))
parse_string ~consume:All ab "aa";;
(* Ok ['a'; 'a'] *)
parse_string ~consume:All ab "bb";;
(* Error "end of input: "*)
doesn’t. I suspect Angstrom cannot backtrack for more than one character, I am not very knowledgeable with parsers.
What would be the simplest solution to achieve what I want to do ?
Thanks in advance