Author: masak
Date: 2010-08-08 09:21:59 +0200 (Sun, 08 Aug 2010)
New Revision: 31923
Modified:
docs/Perl6/Spec/S32-setting-library/Str.pod
Log:
[S32/Str] cruft-removal for &pack
- Ditch the encoding bit for now. Users can encode to Str the usual way.
- Not sure a typed slurpy parameter is going to fly. Changing to a 'where'
clause.
- Added TOP rule to grammar, anchoring at start and end of format string.
Modified: docs/Perl6/Spec/S32-setting-library/Str.pod
===================================================================
--- docs/Perl6/Spec/S32-setting-library/Str.pod 2010-08-08 06:06:34 UTC (rev
31922)
+++ docs/Perl6/Spec/S32-setting-library/Str.pod 2010-08-08 07:21:59 UTC (rev
31923)
@@ -269,9 +269,7 @@
=item pack
- our Str multi pack( Str::Encoding $encoding, Pair *...@items )
- our Str multi pack( Str::Encoding $encoding, Str $template, *...@items )
- our buf8 multi pack( Pair *...@items )
+ our buf8 multi pack( *...@items where { @items »~~» Pair })
our buf8 multi pack( Str $template, *...@items )
C<pack> takes a list of pairs and formats the values according to
@@ -280,26 +278,17 @@
the specifications in the template string. The result is a sequence
of bytes.
-An optional C<$encoding> can be used to specify the character
-encoding to use in interpreting the result as a C<Str>, otherwise the return
-value will simply be a C<buf> containing the bytes generated
-by the template(s) and value(s). Note that no guarantee is made
-in terms of the final, internal representation of the string, only
-that the generated sequence of bytes will be interpreted as a
-string in the given encoding, and a string containing those
-graphemes will be returned. If the sequence of bytes represents
-an invalid string according to C<$encoding>, an exception is generated.
-
Templates are strings of the form:
grammar Str::PackTemplate {
- regex template { [ <group> | <specifier> <count>? ]* }
- token group { \( <template> \) }
- token specifier { <[aazbbhhccssiillnnvvqqjjfdfdppuuw...@]> \!? }
- token count { \* |
- \[ [ \d+ | <specifier> ] \] |
- \d+ }
- }
+ regex TOP { ^ <template> $ }
+ regex template { [ <group> | <specifier> <count>? ]* }
+ token group { \( <template> \) }
+ token specifier { <[aazbbhhccssiillnnvvqqjjfdfdppuuw...@]> \!? }
+ token count { \*
+ | \[ [ \d+ | <specifier> ] \]
+ | \d+ }
+ }
In the pairwise mode, each key must contain a single C<< <group> >> or
C<< <specifier> >>, and the values must be either scalar arguments or