Commit Graph

11 Commits (f7d20f161ae2103d376bd7432c1c7ba2b64023dc)

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 def31744f9 remove all $Id keywords
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13013 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-10-15 17:50:56 +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 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
Daniel de Rauglaudre 72f429f49e Généralisation de certains types afin que les fichiers cmo puissent être
utilisés dans l'extension de syntaxe pa_ocamllex.ml d'Alain Frisch. Ajouté
syntax.ml, copie de syntax.mli, pour pa_ocamllex.ml (problème avec Dynlink,
mais qui pourra être résolu un jour peut-être).


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@4218 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2002-01-04 10:01:50 +00:00
Xavier Leroy cc0f32b054 Changement de la licence
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2553 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1999-11-17 18:59:06 +00:00
Xavier Leroy 3e3d57a3e4 Detection des debordements de tables
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1969 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1998-05-26 09:56:41 +00:00
Xavier Leroy 56fafddd87 Generation de messages # lineno
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1930 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1998-04-23 08:24:50 +00:00
Xavier Leroy 2301d778e7 Renommage en Objective Caml
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@782 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1996-04-30 14:53:58 +00:00
Xavier Leroy 22bc127a92 csllex utilise un automate a pile
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@667 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1996-02-25 14:45:47 +00:00