diff options
author | Jeremy Dorn <jeremy@jeremydorn.com> | 2013-03-31 15:21:10 -0700 |
---|---|---|
committer | Jeremy Dorn <jeremy@jeremydorn.com> | 2013-03-31 15:21:10 -0700 |
commit | 4ca0c1b7e6501ec3404c07675372cf6076d8628b (patch) | |
tree | e4d90fe894dc595a700876bc56237be13201baaf /lib | |
parent | fa92df63b164d001a37db5bf1460ef8ce3271a11 (diff) | |
download | sql-formatter-4ca0c1b7e6501ec3404c07675372cf6076d8628b.zip sql-formatter-4ca0c1b7e6501ec3404c07675372cf6076d8628b.tar.gz sql-formatter-4ca0c1b7e6501ec3404c07675372cf6076d8628b.tar.bz2 |
Fixing bug with comment formatting. Fixes #36
Diffstat (limited to 'lib')
-rw-r--r-- | lib/SqlFormatter.php | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/SqlFormatter.php b/lib/SqlFormatter.php index 6f589a5..c96a3a1 100644 --- a/lib/SqlFormatter.php +++ b/lib/SqlFormatter.php @@ -394,17 +394,6 @@ class SqlFormatter $increase_block_indent = false; array_unshift($indent_types,'block'); } - - // Display comments directly where they appear in the source - if ($token[self::TOKEN_TYPE] === self::TOKEN_TYPE_COMMENT || $token[self::TOKEN_TYPE] === self::TOKEN_TYPE_BLOCK_COMMENT) { - if ($token[self::TOKEN_TYPE] === self::TOKEN_TYPE_BLOCK_COMMENT) { - $return .= "\n" . str_repeat($tab,$indent_level); - } - - $return .= $highlighted; - $newline = true; - continue; - } // If we need a new line before the token if ($newline) { @@ -416,6 +405,17 @@ class SqlFormatter $added_newline = false; } + // Display comments directly where they appear in the source + if ($token[self::TOKEN_TYPE] === self::TOKEN_TYPE_COMMENT || $token[self::TOKEN_TYPE] === self::TOKEN_TYPE_BLOCK_COMMENT) { + if ($token[self::TOKEN_TYPE] === self::TOKEN_TYPE_BLOCK_COMMENT) { + $return .= "\n" . str_repeat($tab,$indent_level); + } + + $return .= $highlighted; + $newline = true; + continue; + } + if($inline_parentheses) { // End of inline parentheses if($token[self::TOKEN_VALUE] === ')') { |