cloudspannerecosystem / memefish

memefish is the foundation to analyze Spanner SQL
https://cloudspannerecosystem.dev/memefish/
MIT License
76 stars 19 forks source link

Allow trailing semicolon in SQL #49

Closed git-hulk closed 2 years ago

makenowjust commented 2 years ago

@git-hulk When I designed the parser, I considered semicolons should be proceeded before parsing (i.e. stmts := strings.Split(s, ";"), and note that we have ParseStatements or some variants, you can use them.). Do you have any reason that they should be proceeded on parsing?

git-hulk commented 2 years ago

@makenowjust Thanks for your quick reply. We use memefish to format the Spanner SQL and users may copy their SQL statements which ends with semicolons. Does it have any side effect if we allow the trailing semicolon?

makenowjust commented 2 years ago

@git-hulk My position: Semicolon is just a separator of a statement, thus this is not a part of a statement. Your change may make it difficult that use semicolons in such a correct way.

You should use ParseStatements instead in this case. It supports trailing semicolons.

git-hulk commented 2 years ago

@makenowjust Thanks for your kindly reply, let’s close this PR.