d22b112 ocamllex: user-definable refill actions (patch by Frédéric Bour)

Authored and Committed by Gabriel Scherer 10 years ago
    ocamllex: user-definable refill actions (patch by Frédéric Bour)
    
    The patch introduces a new "refill" action. It's optional and if
    unused the lexer specification and behavior are unchanged.
    
    When specified, it allows the user to control the way the lexer is
    refilled. For example, an appropriate refill handler could perform the
    blocking operations of refilling under a concurrency monad such as Lwt
    or Async, to work better in a cooperative concurrency setting.
    
    To make use of this feature, add
    
      refill {refill_function}
    
    between the header and the first rule.
    
    [refill_function] is a function which will be invoked by the lexer
    immediately before refilling the buffer. The function will receive as
    arguments the continuation to invoke to resume the lexing, and the
    current lexing buffer.
    
    More precisely, it's a function of type:
    
      (Lexing.lexbuf -> 'a) -> Lexing.lexbuf -> 'a
    
    where the first argument is the continuation which captures the
    processing ocamllex would usually perform (refilling the buffer, then
    calling the lexing function again), and the result type ['a] should
    unify with the result types of all rules.
    
    git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14461 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
    
        
file modified
+8 -0
file modified
+2 -0
file modified
+1 -0
file modified
+2 -2
file modified
+19 -7
file modified
+1 -0
file modified
+92 -44
file modified
+1 -0
file modified
+9 -4
file modified
+6 -4
file modified
+6 -4