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
211 stars 77 forks source link

Parse error - keyword 'except' #179

Closed khirzer closed 7 months ago

khirzer commented 7 months ago

Hi!

This code causes a parse error (zpa version 3.3.0):

procedure test is
  except exception;
begin
  null;
end test;
org.sonar.plugins.plsqlopen.api.sslr.RecognitionException: Parse error at line 2 column 2:

    1: procedure test is
  -->    except exception;
    3: begin
    4:   null;
    5: end test;
    6: 
    7: 
    8: EOF

    at com.felipebz.flr.internal.vm.Machine$Companion.parse(Machine.kt:211)
    at com.felipebz.flr.impl.Parser.parse(Parser.kt:83)
    at com.felipebz.flr.impl.Parser.parse(Parser.kt:76)
    at org.sonar.plsqlopen.TestPlSqlVisitorRunner.createContext(TestPlSqlVisitorRunner.kt:44)
    at org.sonar.plsqlopen.TestPlSqlVisitorRunner.scanFile(TestPlSqlVisitorRunner.kt:37)
    at org.sonar.plsqlopen.checks.verifier.PlSqlCheckVerifier$Companion.verify(PlSqlCheckVerifier.kt:105)
    at org.sonar.plsqlopen.checks.verifier.PlSqlCheckVerifier$Companion.verify$default(PlSqlCheckVerifier.kt:101)
    at org.sonar.plsqlopen.checks.verifier.PlSqlCheckVerifier$Companion.verify(PlSqlCheckVerifier.kt)
    at org.sonar.plsqlopen.checks.verifier.PlSqlCheckVerifier.verify(PlSqlCheckVerifier.kt)

As far as I know 'except' is a keyword but not a reserved word -> it should be possible to use 'except' as an identifier although this is not recommended. https://docs.oracle.com/en/database/oracle/oracle-database/21/lnpls/plsql-reserved-words-keywords.html

This issue is related to changes of https://github.com/felipebz/zpa/issues/157

Could you please take a look at this? Thank you very much!

felipebz commented 7 months ago

Hi @khirzer! Thanks for reporting this issue.