Author: lwall
Date: 2009-11-13 18:44:13 +0100 (Fri, 13 Nov 2009)
New Revision: 29067
Modified:
docs/Perl6/Spec/S05-regex.pod
Log:
[S05] <foo=bar> doesn't suppress bar capture, use <foo=.bar> for that
Send :keepall off to go and live with :panic.
Modified: docs/Perl6/Spec/S05-regex.pod
===================================================================
--- docs/Perl6/Spec/S05-regex.pod 2009-11-13 16:12:41 UTC (rev 29066)
+++ docs/Perl6/Spec/S05-regex.pod 2009-11-13 17:44:13 UTC (rev 29067)
@@ -16,8 +16,8 @@
Created: 24 Jun 2002
- Last Modified: 06 Nov 2009
- Version: 108
+ Last Modified: 13 Nov 2009
+ Version: 109
This document summarizes Apocalypse 5, which is about the new regex
syntax. We now try to call them I<regex> rather than "regular
@@ -494,13 +494,6 @@
=item *
-The new C<:keepall> modifier causes this regex and all invoked subrules
-to remember everything, even if the rules themselves don't ask for
-their subrules to be remembered. This is for forcing a grammar that
-throws away whitespace and comments to keep them instead.
-
-=item *
-
The new C<:ratchet> modifier causes this regex to not backtrack by default.
(Generally you do not use this modifier directly, since it's implied by
C<token> and C<rule> declarations.) The effect of this modifier is
@@ -1163,6 +1156,13 @@
$<foo> = <bar>
+Note that this aliasing does not modify the original C<< <bar> >> capture.
+To rename a capture entirely, use the dot form on the capture you wish
+to suppress:
+
+ <foo=.bar>
+ $<foo> = <.bar>
+
Multiple aliases are allowed, so
<foo=pub=bar>
@@ -1221,8 +1221,6 @@
The extra pattern matching arguments (C<$depth>, C<$binding>, and
C<$fate>) must be supplied explicitly.
-The non-capturing behavior may be overridden with a C<:keepall>.
-
=item *
A leading C<$> indicates an indirect subrule. The variable must contain
@@ -3657,28 +3655,6 @@
=back
-=head2 C<:keepall>
-
-=over
-
-=item *
-
-All regexes remember everything if C<:keepall> is in effect
-anywhere in the outer dynamic scope. In this case everything inside
-the angles is used as part of the key. Suppose the earlier example
-parsed whitespace:
-
- / <key> <.ws> '=>' <.ws> <value> { %hash{$key} = $value } /
-
-The two instances of C<< <.ws> >> above would store an array of two
-values accessible as C<< @<.ws> >>. It would also store the literal
-match into C<< $<'=\>'> >>. Just to make sure nothing is forgotten,
-under C<:keepall> any text or whitespace not otherwise remembered is
-attached as an extra property on the subsequent node. (The name of
-that property is "C<pretext>".)
-
-=back
-
=head1 Grammars
=over
@@ -3781,7 +3757,7 @@
Hence:
given $source_code {
- $parsetree = m:keepall/<Perl::prog>/;
+ $parsetree = STD.parse($source_code)
}
=item *