'delete from' => 1,
);
-sub whitespace_keyword {
+sub pad_keyword {
my ($self, $keyword, $depth) = @_;
my $before = '';
return join (" $car ", map $self->unparse($_, $bindargs, $depth), @{$cdr});
}
else {
- my ($l, $r) = @{$self->whitespace_keyword($car, $depth)};
+ my ($l, $r) = @{$self->pad_keyword($car, $depth)};
return sprintf "$l%s %s$r", $self->format_keyword($car), $self->unparse($cdr, $bindargs, $depth);
}
}
Currently this just takes a keyword and puts the C<colormap> stuff around it.
Later on it may do more and allow for coderef based transforms.
-=head2 whitespace_keyword
+=head2 pad_keyword
- my ($before, $after) = @{$sqlat->whitespace_keyword('SELECT')};
+ my ($before, $after) = @{$sqlat->pad_keyword('SELECT')};
Returns whitespace to be inserted around a keyword.
Removes last arg from passed arrayref and returns it, surrounded with
the values in placeholder_surround, and then surrounded with single quotes.
+
+=head2 indent
+
+Returns as many indent strings as indent amounts times the first argument.
+
+=head1 ACCESSORS
+
+=head2 colormap
+
+See L</new>
+
+=head2 fill_in_placeholders
+
+See L</new>
+
+=head2 indent_amount
+
+See L</new>
+
+=head2 indent_string
+
+See L</new>
+
+=head2 indentmap
+
+See L</new>
+
+=head2 newline
+
+See L</new>
+
+=head2 placeholder_surround
+
+See L</new>
+
});
for ( keys %{$sqlat->indentmap}) {
- my ($l, $r) = @{$sqlat->whitespace_keyword($_, 1)};
+ my ($l, $r) = @{$sqlat->pad_keyword($_, 1)};
is($r, ' ', "right is a space for $_");
is($l, "\n " . ' ' x $sqlat->indentmap->{$_}, "left calculated correctly for $_" );
}
-is($sqlat->whitespace_keyword('select', 0)->[0], '', 'Select gets no newline or indent for depth 0');
+is($sqlat->pad_keyword('select', 0)->[0], '', 'Select gets no newline or indent for depth 0');
done_testing;