[svn:perl6-synopsis] r14385 - doc/trunk/design/syn
Author: larry Date: Fri Apr 27 08:46:01 2007 New Revision: 14385 Modified: doc/trunk/design/syn/S05.pod Log: Correction noted by bsb++ Modified: doc/trunk/design/syn/S05.pod == --- doc/trunk/design/syn/S05.pod(original) +++ doc/trunk/design/syn/S05.podFri Apr 27 08:46:01 2007 @@ -14,9 +14,9 @@ Maintainer: Patrick Michaud [EMAIL PROTECTED] and Larry Wall [EMAIL PROTECTED] Date: 24 Jun 2002 - Last Modified: 17 Apr 2007 + Last Modified: 27 Apr 2007 Number: 5 - Version: 57 + Version: 58 This document summarizes Apocalypse 5, which is about the new regex syntax. We now try to call them Iregex rather than regular @@ -375,6 +375,8 @@ match at all possible character positions (including overlapping) and return all matches in a list context, or a disjunction of matches in a scalar context. The first match at any position is returned. +The matches are guaranteed to be returned in left-to-right order with +respect to the starting positions. $str = abracadabra; @@ -384,13 +386,20 @@ =item * -With the new C:ex (C:exhaustive) modifier, the current regex will match -every possible way (including overlapping) and return all matches in a list -context, or a disjunction of matches in a scalar context. +With the new C:ex (C:exhaustive) modifier, the current regex will +match every possible way (including overlapping) and return all matches +in a list context, or a disjunction of matches in a scalar context. +The matches are guaranteed to be returned in left-to-right order with +respect to the starting positions. The order within each starting +position is not guaranteed and may depend on the nature of both the +pattern and the matching engine. (Conjecture: or we could enforce +backtracking engine semantics. Or we could guarantee no order at all +unless the pattern starts with :: or some such to suppress DFAish +solutions.) $str = abracadabra; - if $str ~~ m:exhaustive/ a (.*) a / { + if $str ~~ m:exhaustive/ a (.*?) a / { say @();# br brac bracad bracadabr c cad cadabr d dabr br }
Re: [svn:perl6-synopsis] r14385 - doc/trunk/design/syn
On Fri, Apr 27, 2007 at 08:46:04AM -0700, [EMAIL PROTECTED] wrote: +The matches are guaranteed to be returned in left-to-right order with +respect to the starting positions. The order within each starting +position is not guaranteed and may depend on the nature of both the +pattern and the matching engine. (Conjecture: or we could enforce +backtracking engine semantics. Or we could guarantee no order at all +unless the pattern starts with :: or some such to suppress DFAish +solutions.) Are you sure you want to guarantee left-to-right starting position order? If there are multiple processors available, and in a lazy context, it may be preferrable to not guarantee any order. Then, if one processor that starts at a later position but which finds a match quickly while another processor starts earlier but needs to take a lot longer to find its first match, the lazy processing can start working on the first match found at the earliest possible time. --
Re: [svn:perl6-synopsis] r14385 - doc/trunk/design/syn
On Fri, Apr 27, 2007 at 03:57:41PM -0400, John Macdonald wrote: : On Fri, Apr 27, 2007 at 08:46:04AM -0700, [EMAIL PROTECTED] wrote: : +The matches are guaranteed to be returned in left-to-right order with : +respect to the starting positions. The order within each starting : +position is not guaranteed and may depend on the nature of both the : +pattern and the matching engine. (Conjecture: or we could enforce : +backtracking engine semantics. Or we could guarantee no order at all : +unless the pattern starts with :: or some such to suppress DFAish : +solutions.) : : Are you sure you want to guarantee left-to-right starting : position order? If there are multiple processors available, and : in a lazy context, it may be preferrable to not guarantee any : order. Then, if one processor that starts at a later position : but which finds a match quickly while another processor starts : earlier but needs to take a lot longer to find its first match, : the lazy processing can start working on the first match found : at the earliest possible time. No, I'm not sure, which is why I put in the conjectures. :-) Larry
Re: [svn:perl6-synopsis] r14385 - doc/trunk/design/syn
On 4/27/07, Larry Wall [EMAIL PROTECTED] wrote: : Are you sure you want to guarantee left-to-right starting : position order? If there are multiple processors available, and : in a lazy context, it may be preferrable to not guarantee any : order. Then, if one processor that starts at a later position : but which finds a match quickly while another processor starts : earlier but needs to take a lot longer to find its first match, : the lazy processing can start working on the first match found : at the earliest possible time. No, I'm not sure, which is why I put in the conjectures. :-) Right. It's a tricky issue from an implementation standpoint. A backtracking NFA most naturally implements it in left-to-right starting position order, whereas a DFA most naturally implements it in left-to-right *ending* position order. Hmm, do we have lazy sets? Luke