Author: larry Date: Fri Aug 17 13:48:23 2007 New Revision: 14437 Modified: doc/trunk/design/syn/S05.pod
Log: <~~$0> and <~~$<foo>> are now just <~~0> and <~~foo> within a closure the current position is now represented by $¢ Modified: doc/trunk/design/syn/S05.pod ============================================================================== --- doc/trunk/design/syn/S05.pod (original) +++ doc/trunk/design/syn/S05.pod Fri Aug 17 13:48:23 2007 @@ -14,9 +14,9 @@ Maintainer: Patrick Michaud <[EMAIL PROTECTED]> and Larry Wall <[EMAIL PROTECTED]> Date: 24 Jun 2002 - Last Modified: 3 Aug 2007 + Last Modified: 17 Aug 2007 Number: 5 - Version: 62 + Version: 63 This document summarizes Apocalypse 5, which is about the new regex syntax. We now try to call them I<regex> rather than "regular @@ -662,6 +662,11 @@ \s+ { print "but does contain whitespace\n" } / +Within a closure, the instantaneous position within the search is +denoted by the special variable C<$¢>. As with all string positions, +you must not treat it as a number unless you are very careful about +which units you are dealing with. + =item * It can affect the match if it calls C<fail>: @@ -1255,8 +1260,8 @@ If omitted, the entire pattern is called recursively: <~~> # call myself recursively - <~~$0> # match according to $0's pattern - <~~$<foo>> # match according to $<foo>'s rule + <~~0> # match according to $0's pattern + <~~foo> # match according to $<foo>'s rule Note that this rematches the pattern associated with the name, not the string matched. So @@ -1265,7 +1270,7 @@ / ( foo | bar ) d $0 / # fails; doesn't match "foo" literally / ( foo | bar ) d <$0> / # fails; doesn't match /foo/ as subrule - / ( foo | bar ) d <~~$0> / # matches using rule associated with $0 + / ( foo | bar ) d <~~0> / # matches using rule associated with $0 The last is equivalent to