Author: larry
Date: Wed Sep 27 10:27:18 2006
New Revision: 12466
Modified:
doc/trunk/design/syn/S05.pod
Log:
Made directly called tokens and rules auto-anchor for readability.
Modified: doc/trunk/design/syn/S05.pod
==============================================================================
--- doc/trunk/design/syn/S05.pod (original)
+++ doc/trunk/design/syn/S05.pod Wed Sep 27 10:27:18 2006
@@ -14,9 +14,9 @@
Maintainer: Patrick Michaud <[EMAIL PROTECTED]> and
Larry Wall <[EMAIL PROTECTED]>
Date: 24 Jun 2002
- Last Modified: 21 Aug 2006
+ Last Modified: 27 Sept 2006
Number: 5
- Version: 33
+ Version: 34
This document summarizes Apocalypse 5, which is about the new regex
syntax. We now try to call them I<regex> rather than "regular
@@ -332,6 +332,23 @@
to imply a C<:> after every construct that could backtrack, including
bare C<*>, C<+>, and C<?> quantifiers, as well as alternations.
+The C<:ratchet> modifier also implies that the anchoring on either
+end is controlled by context. When a ratcheted regex is called as
+a subrule, the front is anchored to the current position (as with
+C<:p>), while the end is not anchored, since the calling context
+will likely wish to continue parsing. However, when a ratcheted
+regex is called directly, it is automatically anchored on both ends.
+(You may override this with an explicit C<:p> or C<:c>.) Thus,
+you can do direct pattern matching using a token or rule:
+
+ $string ~~ token { \d+ }
+ $string ~~ rule { \d+ }
+
+and these are equivalent to
+
+ $string ~~ m/^ \d+: $/;
+ $string ~~ m/^ <ws> \d+: <ws> $/;
+
=item *
The new C<:panic> modifier causes this regex and all invoked subrules