parsing of comments #59

Closed
andialbrecht opened this Issue Apr 18, 2012 · 1 comment

Projects

None yet

1 participant

@andialbrecht
Owner

_This is a _shadow issue* for Issue 59 on Google Code (from which this project was moved).
Added 2012-02-26T22:47:11.000Z by richardgmcmahon@gmail.com.
Labels: Type-Defect, Priority-Medium, Formatter, Parser.
Please make updates to the bug there.*

Original description

On the online parser comments are removed ok but c-style comments are
and single line -- comments cause problems especially with long varaiables.

e.g. using the online parser.

select * 
foo, bar,
/* c-style comment */
rtrim(substring(mfy.filename,charindex('w2',mfy.filename,-1),32)) 
AS yfilename,
bar, foo
/* this
is
another
comment
*/
from foo 
-- another comment
join bar on val1 = val2 where id = 123;

is parsed with the comments serial in the query. For the
-- syntax this will break the SQL. It would be better IMHO
to parse the comments as separate lines breaking at 80chars.

Also the long varaiable causes alignment problems when combined
with a comment.

see below. This is not rendered properly due to line wrapping see
the Web interface. The sqlformat command gives a similar result.

SELECT * foo, bar, /* c-style comment */ rtrim(substring(mfy.filename,charindex('w2',mfy.filename,-1),32)) AS yfilename,
                                         bar,
                                         foo /* this
is
another
comment
*/
FROM foo -- another comment
JOIN bar ON val1 = val2
WHERE id = 123;
@andialbrecht
Owner

Fixed in e4bccf4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment