antlr / grammars-v4

Grammars written for ANTLR v4; expectation that the grammars are free of actions.
MIT License
10.06k stars 3.68k forks source link

PLSQL identifiers can be keywords #720

Open stephendrew opened 7 years ago

stephendrew commented 7 years ago

Suggest making a rule for keyword tokens, and allow them to be used as identifiers.

stephendrew commented 7 years ago

I believe this will fix #553 and #643

stephendrew commented 7 years ago

Actually, I notice some attempt has been made at adding these keywords to the regular_id already, but the list seems incorrect (e.g. DELETE is a keyword and can be an identifier).

KvanTTT commented 7 years ago

You are right: regular_id contains some keywords. It would be great if you add missing and remove wrong keywords from this rule :)

stephendrew commented 7 years ago

In my divergent grammar, which I am trying to reconcile with this, I had a separate plsql_keyword (and plsql_reserved_word) rule - which approach do you prefer - using such a rule? Or simply adding to regular_id...?

KvanTTT commented 7 years ago

I like your approach.