Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for comments #30

Open
lovasoa opened this issue Sep 16, 2018 · 2 comments
Open

Add support for comments #30

lovasoa opened this issue Sep 16, 2018 · 2 comments

Comments

@lovasoa
Copy link
Contributor

lovasoa commented Sep 16, 2018

It would be nice to be able to parse SQL statements with comments in them.

Example

create--blah blah
table--blah blah
tt--blah blah
(--blah blah
x--blah blah
)--blah blah
;
@ms705
Copy link
Owner

ms705 commented Oct 3, 2018

Agreed -- and support for /* ... */-style comments would also be nice.

The best way to do this is perhaps to pre-process the entire input string with a parse rule (or regex) that removes all comments before running through the normal parser sequence.

I'll try to implement this when I get a chance -- probably not for another two weeks or so, though.

@lovasoa
Copy link
Contributor Author

lovasoa commented Oct 8, 2018

I'm not sure this can be done with a simple input preprocessing rule. How would you handle cases such as :

select '
   -- this is not an SQL comment
';

or

INSERT INTO t VALUES ('/*', '*/');

or

se/**/lect 0;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants