felipebz / zpa

Parser and static code analysis tool for PL/SQL and Oracle SQL.
https://zpa.felipebz.com
GNU Lesser General Public License v3.0
213 stars 78 forks source link

Can there be a grammar rule that will identify the new line? #100

Closed HaroonRaizada closed 5 years ago

HaroonRaizada commented 5 years ago

I have a requirement like, i have to ensure that sql code is properly intended. I have to check if there is a new line in the statement or not. Is there any way to achieve that?

felipebz commented 5 years ago

Hi.

You could write a custom rule checking the node.getToken().getLine() and node.getToken().getColumn() of the AstNode instance, compare them and you'll know if the code is indented. But depending what exactly you want to do, this will become very complicated...