Browse thread
[Caml-list] Lexing.lexeme_start_p broken?
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | skaller <skaller@u...> |
| Subject: | Re: [Caml-list] Lexing.lexeme_start_p broken? |
On Mon, 2004-09-20 at 19:23, Jean-Christophe Filliatre wrote:
> simplified to
>
> let update_loc lexbuf =
> let pos = lexbuf.lex_curr_p in
> lexbuf.lex_curr_p <-
> { pos with pos_lnum = pos.pos_lnum + 1; pos_bol = pos.pos_cnum }
>
> then you call this function for each newline in your lexer actions, e.g.
>
> | '\n'
> { newline lexbuf; token lexbuf }
>
> Hope this helps,
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.
--
John Skaller, mailto:skaller@users.sf.net
voice: 061-2-9660-0850,
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net
-------------------
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