Bug #82540 Names for keyword identifier parser rules can be clearer
Submitted: 11 Aug 2016 8:24 Modified: 11 Aug 2016 14:08
Reporter: Martin Hansson Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Parser Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: CPU Architecture:Any

[11 Aug 2016 8:24] Martin Hansson
Description:
This is a pure refactoring which only renames things.

We have a couple of parser rules to handle when non-sql keywords are used as identifiers. The sets of allowed keywords differ between roles, labels and variables. But the rules have abstract names that have nothing to do with their purpose, and they read awkwardly in English.

How to repeat:
It is currently hard to figure out the meaning of e.g. keyword_role_aux1.

Suggested fix:
Rename the rules as follows:

keyword -> ident_keyword (more consistent with <ident>, the only rule producing it, also more descriptive)

keyword_role -> role_keyword (reads like English)

keyword_sp -> label_keyword (more consistent with <label_ident> which producing it)

keyword_role_aux1 -> role_or_label_keyword (describes what it is used for)

keyword_role_aux2 -> role_or_ident_keyword (describes what it is used for)

The names currently have a lot of comments that will hardly be needed if we use these names instead.
[11 Aug 2016 14:08] Paul DuBois
Posted by developer:
 
Fixed in 8.0.0.

Code refactoring. No changelog entry needed.