diff --git a/src/core/CCParse.ml b/src/core/CCParse.ml index d3d55f55..465e9f76 100644 --- a/src/core/CCParse.ml +++ b/src/core/CCParse.ml @@ -657,12 +657,12 @@ let take len : slice t = { ) } -let any_chars len : _ t = take len >|= Slice.to_string +let any_char_n len : _ t = take len >|= Slice.to_string let exact s = { run=fun st ~ok ~err -> (* parse a string of length [String.length s] and compare with [s] *) - (any_chars (String.length s)).run st + (any_char_n (String.length s)).run st ~ok:(fun st s2 -> if string_equal s s2 then ok st s else ( diff --git a/src/core/CCParse.mli b/src/core/CCParse.mli index 78f01389..274d4852 100644 --- a/src/core/CCParse.mli +++ b/src/core/CCParse.mli @@ -190,8 +190,8 @@ val any_char : char t It still fails if the end of input was reached. @since NEXT_RELEASE *) -val any_chars : int -> string t -(** [any_chars len] parses exactly [len] characters from the input. +val any_char_n : int -> string t +(** [any_char_n len] parses exactly [len] characters from the input. Fails if the input doesn't contain at least [len] chars. @since NEXT_RELEASE *)