Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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 Archives:
Bug reports: FAQ:
Beginner's list: