From: Arthur Axel "fREW" Schmidt Date: Thu, 9 Sep 2010 02:51:23 +0000 (+0000) Subject: fix oddity in initial newlines X-Git-Tag: v1.70~70 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=728f26a266b8bcfa7fad80617d4015c7d0b81474;p=dbsrgits%2FSQL-Abstract.git fix oddity in initial newlines --- diff --git a/lib/SQL/Abstract/Tree.pm b/lib/SQL/Abstract/Tree.pm index fedba48..36a2ce9 100644 --- a/lib/SQL/Abstract/Tree.pm +++ b/lib/SQL/Abstract/Tree.pm @@ -278,6 +278,14 @@ sub format_keyword { return $keyword } + +my %starters = ( + select => 1, + update => 1, + 'insert into' => 1, + 'delete from' => 1, +); + sub whitespace { my ($self, $keyword, $depth) = @_; @@ -285,7 +293,7 @@ sub whitespace { if (defined $self->indentmap->{lc $keyword}) { $before = $self->newline . $self->indent($depth + $self->indentmap->{lc $keyword}); } - $before = '' if $depth == 0 and lc $keyword eq 'select'; + $before = '' if $depth == 0 and defined $starters{lc $keyword}; return [$before, ' ']; }