Description
In various recent PRs, we've been reserving words that are used in identifier contexts, like init
, postinit
, these
, range
, etc. without adding them to the parser because doing so has been considered much more laborious.
In #23283, @DanilaFe played a cute trick in which he made init
into a reserved word in the lexer, but then fed it into the identifier rule(s) in the parser such that all downstream code would still work as it was; yet in a way that we could easily add new rules about the token in the parser.
While we don't currently have a need for adding parser rules for the other reserved words in the list above, it seems as though it would be worthwhile to reserve them in the lexer and similarly pass them through the identifier rule(s) if for no other reason than someone looking at the lexer file, or comparing it to the highlighter they were writing, or the language spec, could feel confident that they were seeing consistent lists of all of the identifiers we considered reserved in Chapel. [In fact, it'd be great to have CI scripts that helped us keep key lists of keywords in lexer, highlighters, spec in sync with one another and complained when they were not].