Define interfaces for each lexer token
refactor(compiler): define interfaces for each lexer token (#43132)
Define interfaces for each lexer tokenrefactordefine interfaces each lexer token compiler
Committed by petebacondarwin
commit message
refactor(compiler): define interfaces for each lexer token (#43132)
These token interfaces will make it easier to reason about tokens in the
parser and in specs.
Previously, it was never clear what items could appear in the `parts`
array of a token given a particular `TokenType`. Now, each token interface
declares a labelled tuple for the parts, which helps to document the token
better.
PR Close #43132Editor assessment
An exemplary refactor. The subject — defining interfaces for each lexer token — is imperative and self-sufficient, with an accurate `refactor(compiler)` pairing. The body explains the prior pain concretely: it was never clear what items could appear in a token's `parts` array for a given `TokenType`, and each new token interface now declares a labelled tuple, documenting the token and easing reasoning in the parser and specs. That is a genuine before-and-after rationale, not a restatement. Footers are the well-formed `PR Close #43132` trailer. Style is clean throughout: no trailing period, sensible length, no junk. The message teaches the problem, the mechanism, and the benefit.