<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2003/10/fe01f456e9804b0aadcf1664b4eb356b"
  from="Alain.Frisch@e..."
  author="Alain.Frisch@e..."
  date="2003-10-06T08:26:42"
  subject="Re: [Caml-list] backslashes in ocamllex"
  prev="2003/10/fb66bbc6c00437c91178e4754d5acdb7"
  next="2003/10/9642c3d2820f5f1c5544f75c65710088"
  prev-in-thread="2003/10/d831cd6b1f0e966eb6a36a5f34c782db"
  next-in-thread="2003/10/fb66bbc6c00437c91178e4754d5acdb7"
  prev-thread="2003/10/674fd596aeeccf052ea3d6535738d4a1"
  next-thread="2003/10/ce7c6be72bb67c47c5a7a60474df99bd"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] backslashes in ocamllex">
<msg 
  url="2003/10/925fbd349fd7a57457dbdae0cc2507bb"
  from="Rafael &apos;Dido&apos; Sevilla &lt;dido@i...&gt;"
  author="Rafael &apos;Dido&apos; Sevilla"
  date="2003-10-06T06:32:04"
  subject="[Caml-list] backslashes in ocamllex">
<msg 
  url="2003/10/d831cd6b1f0e966eb6a36a5f34c782db"
  from="Christian Lindig &lt;lindig@c...&gt;"
  author="Christian Lindig"
  date="2003-10-06T08:07:35"
  subject="Re: [Caml-list] backslashes in ocamllex">
<msg 
  url="2003/10/fe01f456e9804b0aadcf1664b4eb356b"
  from="Alain.Frisch@e..."
  author="Alain.Frisch@e..."
  date="2003-10-06T08:26:42"
  subject="Re: [Caml-list] backslashes in ocamllex">
</msg>
</msg>
<msg 
  url="2003/10/fb66bbc6c00437c91178e4754d5acdb7"
  from="Jean-Christophe Filliatre &lt;Jean-Christophe.Filliatre@l...&gt;"
  author="Jean-Christophe Filliatre"
  date="2003-10-06T08:10:01"
  subject="Re: [Caml-list] backslashes in ocamllex">
</msg>
</msg>
</thread>

<contents>
On Mon, 6 Oct 2003, Christian Lindig wrote:

&gt; and string = parse (* lexer for strings *)
&gt;     eof     -&gt; { fun buf -&gt; error "EOF in string" }
&gt;   | '\\' _  -&gt; { fun buf -&gt; let c = getchar lexbuf 1 in
&gt;...
&gt;   | _       -&gt; { fun buf -&gt; string lexbuf (Buffer.add_string (get lexbuf)
&gt;   | "'"     -&gt; { fun buf -&gt; Buffer.contents buf } (* return string *)

Note that the new ocamllex in OCaml 3.07 allows rules to have extra
arguments. It is both more readable and more efficient (no closure is
built for each action) than explicit abstractions in actions.

(Btw the CHANGES file fails to mention this new feature.)


-- Alain

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners

</contents>

</message>

