Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] stream parser jump-back
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Max Kirillov <max630@m...>
Subject: [Caml-list] stream parser jump-back
Hello!

Is it possible in a stream parser to parse again already
accepted token.

An example (a little incorrect) follows.

I'd like to make this in camlp:

A(B).c --> let module M = A(B) in M.c

To do that, i write (scematically):

expr:
[[ m = module_expr; "."; e = expr -> ... ]]

"Note" may be parsed as either module expression or a usual
one. But, expr cannot be followed by a period (that's wrong,
I know, but let's forget about it for a while). Then,
writing None, I've got the Stream.Error and parsing error.

So, can I write something like:
[[ TRY (m = module_expr); "."; ... and so on, do get parsing
failure insted of error, and push the successful head of failed
structute back into a stream, to parse it again (as an expr
now)?

Thanks for your attention.
Max.
-------------------
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