Commits

camlspotter  committed b5d9999

comments

  • Participants
  • Parent commits e3787d6

Comments (0)

Files changed (2)

   (** fast retrieval of the prefix string of the given length *)
 
   val takeWhile : (char -> bool) -> string t
+  (** [takeWhile p] matches the longest prefix string where all the chars hold [p] *)
+
   val ( ??** ) : (char -> bool) -> string t
   val ( ??* ) : (char -> bool) -> unit t
+  (** Same as [Planck_intf.( ?** )] and [Planck_intf.( ?* )] but specialized for char stream *)   
 
   val string : string -> unit t
-  (** Efficient version using Sbuffer. *)
+  (** Efficient version of [Pchar.string] using Sbuffer. 
+      [string s] succeeds if the prefix of the stream is [s]. *)
 
   val chars_to_string : char list t -> string t
+  (** Type conversion from [char list t] to [string t].
+      For efficiency reason, users is not encouraged to use this function. Use [matched] instead.
+  *)
 
   val matched : unit t -> string t
+  (** [matched t] returns the matched string part of [t].
+      It is far more efficient than manual concatenation of chars using [chars_to_string].
+  *)
+
   val with_matched : 'a t -> ('a * string) t
+  (** [with_matched t] returns the matched string part of [t] 
+      along with the original result of [t]. *)
+
   val ( </> ) : 'a t -> 'a t -> 'a t
+  (** Longest match. [a </> b] succeeds if either [a] or [b] succeeds.
+      If the both of [a] and [b] succeeds, the longer match is used as the result of [a </> b].
+
+      Note: [a </> b] runs both [a] and [b]. Too many uses of [</>] affects the parsing performance badly.
+  *)
 end
-(** Monadic parser for char stream *)
+(** Monadic parser for char stream. 
+
+    For better performance, Pbuffer is encouraged to use, instead of this Pchar module.
+ *)
 
 (** Extend(Str)(Base) extends Base for Str with string operations
     Typical usage is:
               and  type Str.Pos.t = Str.Pos.t) :
 sig
   val string : string -> unit Base.t
+  (** [string s] succeeds if the prefix of the stream is [s]. *)
+
   val chars_to_string : char list Base.t -> string Base.t
+  (** Type conversion from [char list t] to [string t]. *)
 end