lexer function .

Olivier Pons (opons@aenegada.inria.fr)
Thu, 31 Oct 1996 11:25:48 +0100 (MET)

Date: Thu, 31 Oct 1996 11:25:48 +0100 (MET)
Message-Id: <199610311025.LAA08481@aenegada.inria.fr>
From: Olivier Pons <opons@aenegada.inria.fr>
To: caml-list@inria.fr
Subject: lexer function .

hello !

I have a little problem with the lexer function generated by make_lexer
in the example below:

let lexer = make_lexer ["("; ")"; "/\\"; "\//"; "~"; "->"];;

let a = (lexer(stream_of_string"a/\~a"));; (* there is no blank*)
a : token stream = <abstr>
#let b = (lexer(stream_of_string"a/\ ~a"));;(* there is a blank*)
b : token stream = <abstr>

and now I just inspect the token stream generated

#stream_next a;;
- : token = Ident "a"
#stream_next b;;
- : token = Ident "a"

but in the next call

#stream_next a;;
- : token = Ident "/\\~"

#stream_next b;;
- : token = Kwd "/\\

#stream_next a;;
- : token = Ident "a"

#stream_next b;;
- : token = Kwd "~"
.......

I don't understand why in the first case the keywords /\\ and ~ are not recognized ?

thank in advance

Olivier