Here is the Antlr grammar file for PLSQL.
However, it is not completely correct. For example, I have a package that starts with:
CREATE OR REPLACE PACKAGE BODY SCHEMA_NAME.PACKAGE_NAME AS
The parser generated from the preceding grammar file does not parse SCHEMA_NAME.PACKAGE_NAME as the package_name (package_name is an Antlr parser rule).
To fix this, I have changed this
package_name
: id
;
To this
package_name
: id ('.' id)?
;
I have also tried
package_name
: id ('.' id_expression)?
;
but none of them worked. Antlr still won't include the last .PACKAGE_NAME part in the package name.
Why is this not working? How can I fix this?
: id ('.' id_expression)?(though that shouldn't change what's being recognized in this case). - Jeroen Mostert