<commit_before>grammar OracleDCLStatement;

import OracleKeyword, Keyword, OracleBase, BaseRule, DataType, Symbol;

grant
    : GRANT
    (
    	(grantSystemPrivileges | grantObjectPrivileges) (CONTAINER EQ_OR_ASSIGN (CURRENT | ALL))?
        | grantRolesToPrograms
    )
    ;
    
grantSystemPrivileges
    : systemObjects TO (granteeClause | granteeIdentifiedBy) (WITH (ADMIN | DELEGATE) OPTION)?
    ; 
    
systemObjects
    : systemObject(COMMA systemObject)*
    ;
          
systemObject
    : ALL PRIVILEGES
    | roleName
    | systemPrivilege
    ;
        
systemPrivilege
    : ID *?
    ;


granteeClause
    : grantee (COMMA grantee)
    ;
    
grantee
    : userName 
    | roleName 
    | PUBLIC 
    ;
    
granteeIdentifiedBy
    : userName (COMMA userName)* IDENTIFIED BY STRING (COMMA STRING)*
    ;
    
grantObjectPrivileges
    : objectPrivilege (COMMA objectPrivilege)*
    ;
    
grantObjectPrivilege
    : (objectPrivilege | ALL PRIVILEGES?)( LEFT_PAREN columnName (COMMA columnName)* RIGHT_PAREN)?
    ;

objectPrivilege
    : ID *?
    ;
    
grantRolesToPrograms
    : roleName (COMMA roleName)* TO programUnit ( COMMA programUnit )*
    ;
    
programUnit
    : (FUNCTION | PROCEDURE | PACKAGE) schemaName? ID
    ;<commit_msg>add onObjectClause<commit_after>grammar OracleDCLStatement;

import OracleKeyword, Keyword, OracleBase, BaseRule, DataType, Symbol;

grant
    : GRANT
    (
    	(grantSystemPrivileges | grantObjectPrivilegeClause) (CONTAINER EQ_OR_ASSIGN (CURRENT | ALL))?
        | grantRolesToPrograms
    )
    ;
    
grantSystemPrivileges
    : systemObjects TO (granteeClause | granteeIdentifiedBy) (WITH (ADMIN | DELEGATE) OPTION)?
    ; 
    
systemObjects
    : systemObject(COMMA systemObject)*
    ;
          
systemObject
    : ALL PRIVILEGES
    | roleName
    | systemPrivilege
    ;
        
systemPrivilege
    : ID *?
    ;


granteeClause
    : grantee (COMMA grantee)*
    ;
    
grantee
    : userName 
    | roleName 
    | PUBLIC 
    ;
    
granteeIdentifiedBy
    : userName (COMMA userName)* IDENTIFIED BY STRING (COMMA STRING)*
    ;
    
grantObjectPrivilegeClause
    : grantObjectPrivilege (COMMA grantObjectPrivilege)* onObjectClause
    TO granteeClause(WITH HIERARCHY OPTION)?(WITH GRANT OPTION)?
    ;
    
grantObjectPrivilege
    : (objectPrivilege | ALL PRIVILEGES?)( LEFT_PAREN columnName (COMMA columnName)* RIGHT_PAREN)? 
    ;

objectPrivilege
    : ID *?
    ;
    
onObjectClause
    : ON 
    (
    	schemaName? ID 
       | USER userName ( COMMA userName)*
       | (DIRECTORY | EDITION | MINING MODEL | JAVA (SOURCE | RESOURCE) | SQL TRANSLATION PROFILE) schemaName? ID 
    )
    ;
    
grantRolesToPrograms
    : roleName (COMMA roleName)* TO programUnit ( COMMA programUnit )*
    ;
    
programUnit
    : (FUNCTION | PROCEDURE | PACKAGE) schemaName? ID
    ;
{'fraction_non_alphanumeric': 0.07967707967707968, 'fraction_numerical': 0.0, 'mean_word_length': 2.7450722733245727, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3017450', 'n_tokens_mistral': 1014, 'n_tokens_neox': 952, 'n_words': 194}