Skip to content

Commit 1db2689

Browse files
committed
Remove trailing whitespace
1 parent f2c0405 commit 1db2689

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

src/HLL/sprintf.nqp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ my module sprintf {
77
:my $*ARGS_USED := 0;
88
^ <statement>* $
99
}
10-
11-
method panic($message, $payload) {
10+
11+
method panic($message, $payload) {
1212
my $ex := nqp::newexception();
1313
nqp::setmessage($ex, $message);
1414
nqp::setpayload($ex, $payload);
1515
nqp::throw($ex);
1616
}
17-
17+
1818
token statement {
1919
[
2020
| <?[%]> [ [ <directive> | <escape> ]
@@ -37,21 +37,21 @@ my module sprintf {
3737

3838
proto token escape { <...> }
3939
token escape:sym<%> { '%' <flags>* <size>? <sym> }
40-
40+
4141
token literal { <-[%]>+ }
42-
42+
4343
token idx {
4444
$<param_index>=[\d+] '$'
4545
}
46-
46+
4747
token flags {
4848
| $<space> = ' '
4949
| $<plus> = '+'
5050
| $<minus> = '-'
5151
| $<zero> = '0'
5252
| $<hash> = '#'
5353
}
54-
54+
5555
token size {
5656
\d* | $<star>='*'
5757
}
@@ -71,7 +71,7 @@ my module sprintf {
7171
~ (+@*ARGS_HAVE < 1 ?? "no argument was"
7272
!! +@*ARGS_HAVE == 1 ?? "1 argument was"
7373
!! +@*ARGS_HAVE ~ " arguments were")
74-
~ " supplied", nqp::hash('DIRECTIVES_COUNT',
74+
~ " supplied", nqp::hash('DIRECTIVES_COUNT',
7575
nqp::hash('ARGS_HAVE', +@*ARGS_HAVE, 'ARGS_USED', $*ARGS_USED)))
7676
}
7777
make nqp::join('', @statements);
@@ -86,11 +86,11 @@ my module sprintf {
8686

8787
sub bad-type-for-directive($type, $directive) {
8888
my $message := "Directive $directive not applicable for type " ~ $type.HOW.name($type);
89-
my $payload := nqp::hash('BAD_TYPE_FOR_DIRECTIVE',
89+
my $payload := nqp::hash('BAD_TYPE_FOR_DIRECTIVE',
9090
nqp::hash('TYPE', $type.HOW.name($type), 'DIRECTIVE', $directive));
9191
panic($message, $payload);
9292
}
93-
93+
9494
sub infix_x($s, $n) {
9595
my @strings;
9696
my int $i := 0;
@@ -198,8 +198,8 @@ my module sprintf {
198198
my $int := intify($next);
199199
my $pad := padding_char($/);
200200
my $sign := nqp::islt_I($int, $zero) ?? '-'
201-
!! has_flag($/, 'plus') ?? '+'
202-
!! has_flag($/, 'space') ?? ' '
201+
!! has_flag($/, 'plus') ?? '+'
202+
!! has_flag($/, 'space') ?? ' '
203203
!! '';
204204
$int := nqp::tostr_I(nqp::abs_I($int, $knowhow));
205205
$int := nqp::substr($int, 0, $<precision>.made) if nqp::chars($<precision>);
@@ -264,12 +264,12 @@ my module sprintf {
264264

265265
my $e := nqp::fromnum_I($d > $precision ?? $d - $precision !! 0, $knowhow);
266266
my $pot := nqp::pow_I(nqp::fromnum_I(10, $knowhow), $e, $knowhow, $knowhow); # power of ten
267-
my $rounder := nqp::mul_I(nqp::fromnum_I(5, $knowhow), $pot, $knowhow);
267+
my $rounder := nqp::mul_I(nqp::fromnum_I(5, $knowhow), $pot, $knowhow);
268268

269269
$rhs_I := nqp::add_I($rhs_I, $rounder, $knowhow);
270270
$rhs_s := nqp::tostr_I($rhs_I);
271271

272-
$lhs_I := nqp::add_I($lhs_I, nqp::fromnum_I(1,$knowhow), $knowhow)
272+
$lhs_I := nqp::add_I($lhs_I, nqp::fromnum_I(1,$knowhow), $knowhow)
273273
if nqp::substr($rhs_s,0,1) ne '1'; # we had a carry
274274

275275
$lhs_s := nqp::tostr_I($lhs_I);
@@ -347,7 +347,7 @@ my module sprintf {
347347
} else {
348348
$sci := $float ~ $e ~ '+' ~ ($exp < 10 ?? '0' !! '') ~ $exp;
349349
}
350-
350+
351351
pad-with-sign($sign, $sci, $size, $pad);
352352
}
353353
}
@@ -424,7 +424,7 @@ my module sprintf {
424424
my $int := intify($next);
425425
if nqp::islt_I($int, $zero) {
426426
my $err := nqp::getstderr();
427-
nqp::printfh($err, "negative value '"
427+
nqp::printfh($err, "negative value '"
428428
~ $int
429429
~ "' for %u in sprintf");
430430
$int := 0;
@@ -491,9 +491,9 @@ my module sprintf {
491491
make $<directive> && !$<directive><idx> ?? 1 !! 0
492492
}
493493
}
494-
494+
495495
my $directives := Directives.new();
496-
496+
497497
sub sprintfdirectives($format) {
498498
return Syntax.parse( $format, :actions($directives) ).made;
499499
}

t/hll/06-sprintf.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ nqp::sprintfaddargumenthandler(SprintfHandler.new);
5959
my $large-positive-int := nqp::pow_I(nqp::box_i(33, $knowhow), nqp::box_i(21, $knowhow), $knowhow, $knowhow);
6060
# my $large-negative-int := fromnum_I(-nqp::pow_n(2.42, 42), $knowhow);
6161

62-
62+
6363
is(nqp::sprintf('<%6s>', [12]), '< 12>', 'right-justified %s with space padding');
6464
is(nqp::sprintf('<%6%>', []), '< %>', 'right-justified %% with space padding');
6565
is(nqp::sprintf('<%06s>', ['hi']), '<0000hi>', 'right-justified %s with 0-padding');
@@ -299,7 +299,7 @@ is(nqp::sprintf('%17.3g', [2.718281828459e+11]), ' 2.72e+11', '%17.3g 2.
299299
is(nqp::sprintf('%17.3e', [2.718281828459e+12]), ' 2.718e+12', '%17.3e 2.718281828459e+12');
300300
is(nqp::sprintf('%17.3f', [2.718281828459e+12]), '2718281828459.000', '%17.3f 2.718281828459e+12');
301301
is(nqp::sprintf('%17.3g', [2.718281828459e+12]), ' 2.72e+12', '%17.3g 2.718281828459e+12');
302-
302+
303303
is(nqp::sprintf('%17.3g', [3.000000000000e-12]), ' 3e-12', '%17.3g 3.000000000000e-12');
304304
is(nqp::sprintf('%17.3g', [3.000000000000e-11]), ' 3e-11', '%17.3g 3.000000000000e-11');
305305
is(nqp::sprintf('%17.3g', [3.000000000000e-10]), ' 3e-10', '%17.3g 3.000000000000e-10');

0 commit comments

Comments
 (0)