* [Caml-list] parse <tags>
@ 2003-12-01 5:55 Pietro Abate
2003-12-01 10:22 ` Stefano Zacchiroli
0 siblings, 1 reply; 2+ messages in thread
From: Pietro Abate @ 2003-12-01 5:55 UTC (permalink / raw)
To: ocaml ml
Hi all,
I'm trying to write a simple parser (below) but I've problems parsing tag-like
keywords. Probably this is a problem related with the lexer. does anybody know
a solution that doesn't imply heavy modifications to the (Genlex) lexer ?
p
code:
#load "camlp4o.cma";;
(* this doesn't work and it's what I want *)
open Genlex;;
let s = "<foo>";;
let flexer = make_lexer [s];;
let s' = flexer (Stream.of_string s);;
let parse_input_line = parser
[< 'Kwd "<foo>" >] -> Printf.printf "bingo !"
;;
parse_input_line s';;
(* this works, but I want < > !! *)
let s = "foo";;
let flexer = make_lexer [s];;
let s' = flexer (Stream.of_string s);;
let parse_input_line = parser
[< 'Kwd "foo" >] -> Printf.printf "bingo ?"
;;
parse_input_line s';;
--
++ As I grow older, I pay less attention to what men say.
I just watch what they do. Andrew Carnegie (1835-1919).
++ Please avoid sending me Word or PowerPoint attachments.
See http://www.fsf.org/philosophy/no-word-attachments.html
-------------------
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Caml-list] parse <tags>
2003-12-01 5:55 [Caml-list] parse <tags> Pietro Abate
@ 2003-12-01 10:22 ` Stefano Zacchiroli
0 siblings, 0 replies; 2+ messages in thread
From: Stefano Zacchiroli @ 2003-12-01 10:22 UTC (permalink / raw)
To: ocaml ml; +Cc: Pietro Abate
On Mon, Dec 01, 2003 at 04:55:32PM +1100, Pietro Abate wrote:
> I'm trying to write a simple parser (below) but I've problems parsing
> tag-like keywords. Probably this is a problem related with the lexer.
> does anybody know a solution that doesn't imply heavy modifications to
> the (Genlex) lexer ?
Genlex module parses just the ocaml syntactic categories, tags you're
trying to parse are not one of them.
You can try ulex or the former, I've never looked at the details but I'm
pretty sure it can do what you want since they are used to parse XML
documents. (See http://www.cduce.org/download.html or the debian
package "ocaml-ulex").
Cheers.
--
^Stefano Zacchiroli -- Master in Computer Science @ Uni. Bologna, Italy$
^zack@{cs.unibo.it,debian.org,bononia.it} -- http://www.bononia.it/zack$
^Frequentando il mio maestro mi ero reso conto [.] che la logica poteva$
^servire a molto a condizione di entrarci dentro e poi di uscirne -Adso$
-------------------
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-12-01 10:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-01 5:55 [Caml-list] parse <tags> Pietro Abate
2003-12-01 10:22 ` Stefano Zacchiroli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).