<?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="2006/02/3de24107f5dd6700992f62be4ab0e6c5"
  from="Nicolas Pouillard &lt;nicolas.pouillard@i...&gt;"
  author="Nicolas Pouillard"
  date="2006-02-14T07:55:29"
  subject="Re: [Caml-list] I don t get the lexer"
  prev="2006/02/f313296d7c99c64a62b09ce3a90c78da"
  next="2006/02/213d8224180bf07a2f189dcc2278d1bd"
  prev-in-thread="2006/02/a74b4211ff6f1c1241c93b24e6b20882"
  prev-thread="2006/02/20b9bddf6cd70a75c82f40d837c93956"
  next-thread="2006/02/37d39060650086440a25f738a8d7ce2b"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="I don t get the lexer">
<msg 
  url="2006/02/a74b4211ff6f1c1241c93b24e6b20882"
  from="jean-david hsu &lt;jhsu1@e...&gt;"
  author="jean-david hsu"
  date="2006-02-13T01:32:58"
  subject="I don t get the lexer">
<msg 
  url="2006/02/3de24107f5dd6700992f62be4ab0e6c5"
  from="Nicolas Pouillard &lt;nicolas.pouillard@i...&gt;"
  author="Nicolas Pouillard"
  date="2006-02-14T07:55:29"
  subject="Re: [Caml-list] I don t get the lexer">
</msg>
</msg>
</thread>

<contents>
On 2/12/06, jean-david hsu &lt;jhsu1@email.sjsu.edu&gt; wrote:
&gt; Hello everyone
Hi,

&gt; how come my lexer does not break "?!" both defined as keywords but puts
&gt; "." aside?

Because the lexer of Genlex is not really generated but parametrized
by a keyword table.

Concerned rules are:
 | Some
        ('!' | '%' | '&amp;' | '$' | '#' | '+' | '/' | ':' | '&lt;' | '=' | '&gt;' |
         '?' | '@' | '\\' | '~' | '^' | '|' | '*' as c) -&gt;
        Stream.junk strm__;
        let s = strm__ in reset_buffer (); store c; ident2 s
[...]
| Some c -&gt; Stream.junk strm__; Some (keyword_or_error c)
[...]
  and ident2 (strm__ : _ Stream.t) =
    match Stream.peek strm__ with
      Some
        ('!' | '%' | '&amp;' | '$' | '#' | '+' | '-' | '/' | ':' | '&lt;' | '=' |
         '&gt;' | '?' | '@' | '\\' | '~' | '^' | '|' | '*' as c) -&gt;
        Stream.junk strm__; let s = strm__ in store c; ident2 s

In short '?' and '!' are in the same character class but '.' is
treated by the default case. Since the lexer search the longest token
that matches, "?!" are packed together but not with a '.' .

--
Nicolas Pouillard
</contents>

</message>

