English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] Lexing.lexeme_start_p broken?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-09-21 (08:26)
From: Damien Doligez <damien.doligez@i...>
Subject: Re: [Caml-list] Lexing.lexeme_start_p broken?
On Sep 20, 2004, at 16:44, skaller wrote:

> How does that help, if the tokeniser isn't using the lexbuf?
> Here's my parser:
> let parse_tokens (parser:'a parser_t) (tokens: Flx_parse.token list) =
>   let toker = (new tokeniser tokens) in
>   try
>     parser (toker#token_src) (Lexing.from_string "dummy" )
>   with _ ->
>     toker#report_syntax_error;
>     raise (Flx_exceptions.ParseError "Parsing Tokens")
> The token supplying function never looks at the lexbuf.
> The parser does, to report errors, so I have to trash
> the parser exceptions, since the locations are wrong.

The token supplying function is supposed to _update_ the lexbuf, if
you want the parser to report the correct locations.  ocamllex does
some of the work by updating the char count, the rest is up to the
lexer itself.

-- Damien

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