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 NAA32219; Mon, 1 Jul 2002 13:45:57 +0200 (MET DST) 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 NAA32388 for ; Mon, 1 Jul 2002 13:45:56 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g61Bjqf23659; Mon, 1 Jul 2002 13:45:52 +0200 (MET DST) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id NAA32176; Mon, 1 Jul 2002 13:45:51 +0200 (MET DST) Date: Mon, 1 Jul 2002 13:45:51 +0200 From: Xavier Leroy To: John Max Skaller Cc: caml-list@inria.fr Subject: Re: [Caml-list] ocamllex -- ambiguous regex Message-ID: <20020701134551.A32025@pauillac.inria.fr> References: <86lmbeuheg.fsf@laurelin.dementia.org> <3D1F3EFB.6090303@ozemail.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <3D1F3EFB.6090303@ozemail.com.au>; from skaller@ozemail.com.au on Mon, Jul 01, 2002 at 03:25:15AM +1000 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > What happens if there is an ambiguous regexp in ocamllex input? > [The manual doesn't say] That's an oversight in the manual; thanks for reporting it. If several regexps match a prefix of the input, the regexp selected is - the one that matches the longest prefix (so-called "longest match rule") - in case of tie on prefix length, the regexp that occurs first in the source .mll lexer. For instance: "kwd" { rule 1 } | ['a'-'z']+ { rule 2 } The input "kwdkwd" will trigger rule 2 (longest match), but "kwd01" will trigger rule 1 (first rule among the two that have longest match). - Xavier Leroy ------------------- 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