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 IAA21141; Mon, 6 Oct 2003 08:32:04 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id IAA04265 for ; Mon, 6 Oct 2003 08:32:03 +0200 (MET DST) Received: from intmail.imperium.ph ([202.175.240.154]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h966W1103091 for ; Mon, 6 Oct 2003 08:32:02 +0200 (MET DST) Received: from morgoth.imperium.ph (unknown [192.168.1.35]) by intmail.imperium.ph (Postfix) with SMTP id 6FDEF46A5E for ; Mon, 6 Oct 2003 14:31:59 +0800 (PHT) Received: by morgoth.imperium.ph (sSMTP sendmail emulation); Mon, 6 Oct 2003 09:37:40 +0800 Date: Mon, 6 Oct 2003 09:37:40 +0800 From: "Rafael 'Dido' Sevilla" To: caml-list@inria.fr Subject: [Caml-list] backslashes in ocamllex Message-ID: <20031006013740.GA2149@imperium.ph> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Operating-System: Linux morgoth 2.4.20-gentoo-r5 User-Agent: Mutt/1.5.4i X-Loop: caml-list@inria.fr X-Spam: no; 0.00; rafael:01 'dido':01 dido:01 ocaml's:01 regex:01 compiler:01 token:01 string:03 sevilla:03 ocamllex:05 hints:06 sequences:06 strings:06 strings:06 i'd:06 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Now I'm stuck again. I'm revising the lexical analyzer for my compiler to enable it to recognize escaped strings, with conventions different from OCaml's. Currently, I'm using this regex: '\'' ("\\\\"|"\\'"|[^'\''])* '\'' in an attempt to recognize strings that begin and end with single quotes, but may possibly include sequences like \' that represent escaped quotes, and '\\' that represent escaped backslashes. Of course, this doesn't work, as I lately realized, because this string: '\\' '\\' looks like I'm escaping the second quote, so I wind up with an empty token. Any hints on how I'd go about doing this sort of thing? ------------------- 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