From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id JAA18723; Wed, 7 Nov 2001 09:44:19 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id JAA18886 for ; Wed, 7 Nov 2001 09:44:18 +0100 (MET) Received: from mail4.uts.ohio-state.edu (mail4.uts.ohio-state.edu [128.146.214.33]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id fA78iHf20372 for ; Wed, 7 Nov 2001 09:44:18 +0100 (MET) Received: from functor.resnet.ohio-state.edu (rpat-100-139.resnet.ohio-state.edu [164.107.100.139]) by mail4.uts.ohio-state.edu (8.9.3/8.9.3) with ESMTP id DAA22091 for ; Wed, 7 Nov 2001 03:44:12 -0500 (EST) Received: by functor.resnet.ohio-state.edu (Postfix, from userid 1001) id 61BFF112D3; Wed, 7 Nov 2001 04:42:23 -0500 (EST) Date: Wed, 7 Nov 2001 04:42:23 -0500 From: Jeremy Fincher To: caml-list@pauillac.inria.fr Subject: [Caml-list] Genlex (question and problem) Message-ID: <20011107044223.A35732@functor.resnet.ohio-state.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk I've just started using the Genlex module for some simple configuration file parsing, and I've run into a problem. First, however, is the question: What's to happen to Genlex once camlp4 is integrated into the standard compiler distribution? Will it be deprecated, will it require me to preprocess my files with camlp4; how will I have to change my Genlex-using source when I upgrade to 3.03? As far as the probem goes, I can't do much better than include the source that's giving me the type error I can't figure out, so here goes: ---------- let record_lexer = make_lexer ["{"; "}"; "="; ";"] (* this is the lexer I use *) type channel_user_stats = { msgs : int; chars : int; words : int; actions : int; kicks : int; modes : int; topics : int; joins : int; } let default_channel_user_stats = { msgs = 0; chars = 0; words = 0; actions = 0; kicks = 0; modes = 0; topics = 0; joins = 0; } type channel_user = { seen : float; flags : string; karma : int; stats : channel_user_stats; } let default_channel_user = { seen = 0.; flags = ""; karma = 0; stats = default_channel_user_stats; } let parse_channel_user = let parse_stats = let rec parse_inside stats = parser | [< 'Ident "msgs"; 'Kwd "="; 'Int i; 'Kwd ";"; rest >] -> parse_inside { stats with msgs = i } rest | [< 'Ident "chars"; 'Kwd "="; 'Int i; 'Kwd ";"; rest >] -> parse_inside { stats with chars = i } rest | [< 'Ident "words"; 'Kwd "="; 'Int i; 'Kwd ";"; rest >] -> parse_inside { stats with words = i } rest | [< 'Ident "actions"; 'Kwd "="; 'Int i; 'Kwd ";"; rest >] -> parse_inside { stats with actions = i } rest | [< 'Ident "kicks"; 'Kwd "="; 'Int i; 'Kwd ";"; rest >] -> parse_inside { stats with kicks = i } rest | [< 'Ident "modes"; 'Kwd "="; 'Int i; 'Kwd ";"; rest >] -> parse_inside { stats with modes = i } rest | [< 'Ident "topics"; 'Kwd "="; 'Int i; 'Kwd ";"; rest >] -> parse_inside { stats with topics = i } rest | [< 'Ident "joins"; 'Kwd "="; 'Int i; 'Kwd ";"; rest >] -> parse_inside { stats with joins = i } rest | [< >] -> stats in parser | [< 'Kwd "{"; stats = parse_inside default_channel_user_stats; 'Kwd "}" >] -> stats in let rec parse_inside cu = parser | [< 'Ident "seen"; 'Kwd "="; 'Int i; 'Kwd ";"; rest >] -> parse_inside { cu with seen = (float_of_int i) } rest | [< 'Ident "flags"; 'Kwd "="; 'String flags; 'Kwd ";"; rest >] -> parse_inside { cu with flags = flags } rest | [< 'Ident "stats"; 'Kwd "="; stats = parse_stats; Kwd ";"; rest >] -> parse_inside { cu with stats = stats } rest | [< 'Ident "karma"; 'Kwd "="; 'Int i; 'Kwd ";"; rest >] -> parse_inside { cu with karma = i } rest | [< >] -> cu in parser | [< 'Kwd "{"; cu = parse_inside default_channel_user; 'Kwd "}" >] -> cu ---------- I get "This pattern matches values of type Genlex.token option but is here used to match values of type Genlex.token Stream.t option", which I *cannot* figure out. Thanks, Jeremy ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr