Skip to content

Commit 7ccf428

Browse files
committed
Make unsigned sprintf types signed, remove modifiers entirely.
1 parent f891058 commit 7ccf428

File tree

1 file changed

+12
-29
lines changed

1 file changed

+12
-29
lines changed

S32-setting-library/Str.pod

Lines changed: 12 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ DRAFT: Synopsis 32: Setting Library - Str
1919

2020
Created: 19 Mar 2009 extracted from S29-functions.pod
2121

22-
Last Modified: 2012-03-26
23-
Version: 7
22+
Last Modified: 2012-07-05
23+
Version: 8
2424

2525
The document is a draft.
2626

@@ -402,13 +402,12 @@ The C<$format> is scanned for C<%> characters. Any C<%> introduces a
402402
format token. Format tokens have the following grammar:
403403

404404
grammar Str::SprintfFormat {
405-
regex format_token { '%': <index>? <precision>? <modifier>? <directive> }
405+
regex format_token { '%': <index>? <precision>? <directive> }
406406
token index { \d+ '$' }
407407
token precision { <flags>? <vector>? <precision_count> }
408408
token flags { <[ \x20 + 0 \# \- ]>+ }
409409
token precision_count { [ <[1..9]>\d* | '*' ]? [ '.' [ \d* | '*' ] ]? }
410410
token vector { '*'? v }
411-
token modifier { < ll l h m V q L > }
412411
token directive { < % c s d u o x e f g X E G b p n i D U O F > }
413412
}
414413

@@ -421,47 +420,31 @@ The directives are:
421420
% a literal percent sign
422421
c a character with the given codepoint
423422
s a string
424-
d a signed integer, in decimal
425-
u an unsigned integer, in decimal
426-
o an unsigned integer, in octal
427-
x an unsigned integer, in hexadecimal
423+
d an integer, in decimal
424+
b an integer, in binary
425+
o an integer, in octal
426+
x an integer, in hexadecimal
427+
X like x, but using uppercase letters
428428
e a floating-point number, in scientific notation
429429
f a floating-point number, in fixed decimal notation
430430
g a floating-point number, in %e or %f notation
431-
X like x, but using uppercase letters
432431
E like e, but using an uppercase "E"
433432
G like g, but with an uppercase "E" (if applicable)
434-
b an unsigned integer, in binary
435433

436434
Compatibility:
437435

438436
i a synonym for %d
439-
D a synonym for %ld
440-
U a synonym for %lu
441-
O a synonym for %lo
437+
u a synonum for %d
438+
D a synonym for %d
439+
U a synonym for %u
440+
O a synonym for %o
442441
F a synonym for %f
443442

444443
Perl 5 (non-)compatibility:
445444

446445
n produces a runtime exception
447446
p produces a runtime exception
448447

449-
Modifiers change the meaning of format directives. At the moment
450-
these are recognized primarily for compatibility with C<printf>
451-
from other languages (notably C and Perl 5), but their exact semantics
452-
are still conjectural.
453-
454-
h interpret integer as native "short" (typically int16)
455-
l interpret integer as native "long" (typically int32 or int64)
456-
ll interpret integer as native "long long" (typically int64)
457-
L interpret integer as native "long long" (typically uint64)
458-
q interpret integer as native "quads" (typically int64 or larger)
459-
460-
Examples:
461-
462-
sprintf "%ld a big number, %lld a bigger number\n",
463-
4294967295, 4294967296;
464-
465448
=item fmt
466449

467450
multi method fmt( Scalar $scalar: Str $format = '%s' --> Str )

0 commit comments

Comments
 (0)