fix regression introduced in 6f2a5b6
[scpubgit/Q-Branch.git] / lib / SQL / Abstract / Tree.pm
index 7ee5c44..dedd8f3 100644 (file)
@@ -99,7 +99,7 @@ $expr_start_re = qr/ $op_look_behind (?i: $expr_start_re ) $op_look_ahead /x;
 # this will be included in the $binary_op_re, the distinction is interesting during
 # testing as one is tighter than the other, plus mathops have different look
 # ahead/behind (e.g. "x"="y" )
-my @math_op_keywords = (qw/ < > != <> = <= >= /);
+my @math_op_keywords = (qw/ - + < > != <> = <= >= /);
 my $math_op_re = join ("\n\t|\n", map
   { "(?: (?<= [\\w\\s] | $quote_right ) | \\A )"  . quotemeta ($_) . "(?: (?= [\\w\\s] | $quote_left ) | \\z )" }
   @math_op_keywords
@@ -590,6 +590,10 @@ sub _unparse {
   elsif ($op eq '-MISC' ) {
     return join (' ', map $self->_unparse($_, $bindargs, $depth), @{$args});
   }
+  elsif ($op =~ qr/^-(ASC|DESC)$/ ) {
+    my $dir = $1;
+    return join (' ', (map $self->_unparse($_, $bindargs, $depth), @{$args}), $dir);
+  }
   else {
     my ($l, $r) = @{$self->pad_keyword($op, $depth)};
     return sprintf "$l%s%s%s$r",