From: skaller <skaller@users.sourceforge.net>
To: Jean-Christophe Filliatre <Jean-Christophe.Filliatre@lri.fr>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] Lexing.lexeme_start_p broken?
Date: 21 Sep 2004 00:44:25 +1000 [thread overview]
Message-ID: <1095691464.2580.554.camel@pelican.wigram> (raw)
In-Reply-To: <16718.41346.210917.885719@gargle.gargle.HOWL>
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
next prev parent reply other threads:[~2004-09-20 14:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-17 22:07 Scott Duckworth
2004-09-20 9:23 ` Jean-Christophe Filliatre
2004-09-20 14:44 ` skaller [this message]
2004-09-21 8:26 ` Damien Doligez
2004-09-21 9:25 ` skaller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1095691464.2580.554.camel@pelican.wigram \
--to=skaller@users.sourceforge.net \
--cc=Jean-Christophe.Filliatre@lri.fr \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox