Commit Graph

12 Commits (3ce32fba4fe8be1c77096ca1f70dd14233d67b49)

Author SHA1 Message Date
Gabriel Scherer d22b112968 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
2014-03-14 15:39:32 +00:00
Damien Doligez 7844495624 Merge branch 4.01 from branching point to 4.01.0+rc1
Command line used:
  svn merge --accept postpone -r 13776:14055 $REPO/version/4.01 .


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14060 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-09-04 15:12:37 +00:00
Alain Frisch a0a14c08fa Enable and fix more warnings.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12498 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-05-29 11:47:28 +00:00
Damien Doligez 3b507dd1aa renaming of Objective Caml to OCaml and cleanup of copyright headers
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@11156 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2011-07-27 14:17:02 +00:00
Luc Maranget 5ca2e4ee42 ocamllex: as bound variables with position in .mll file
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@7815 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2007-01-29 16:44:16 +00:00
Damien Doligez d200cf6df1 PR#1803
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5815 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2003-08-29 17:33:45 +00:00
Damien Doligez e6503e0a08 pour que les actions vides marchent comme avant
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5779 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2003-08-14 18:11:36 +00:00
Damien Doligez 25cea4adbe gestion des locations avec -ml; meilleur parenthesage pour -dtypes
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5747 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2003-07-26 21:06:21 +00:00
Luc Maranget 513ae1bbfe esthetique
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5329 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2002-12-10 09:14:30 +00:00
Luc Maranget 11392c1894 arguments supplementaires pour les lexers ocamllex
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5323 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2002-12-09 10:44:46 +00:00
Damien Doligez 123fb9f713 changement des locations, deuxieme tranche
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5232 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2002-11-02 22:36:46 +00:00
Luc Maranget c417b82d9e nouveau ocamllex
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5193 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2002-10-28 16:46:50 +00:00