The standard uses the same language to specify the lexical grammar of both template tails and RegExp literals, but in practice we implement those two quirks in totally different ways.
TemplateTail is thrown into
Modifier (our solution for the RegExp problem) anyway, even though it's not relevant there. One consequence of this is that there's a very cold check for
Modifier::TemplateTail at the top of
TokenStreamSpecific<>::getTokenInternal, which is very hot code. Let's remove that.
Separately: when we do scan a token in
TemplateTail mode, we produce either a
TemplateHead (meaning TemplateMiddle) or
NoSubsTemplate (meaning TemplateTail) token. I wrote a comment documenting this, but it felt silly. So I am going to splurge and purchase two new
TokenKind enumerators for TemplateMiddle and TemplateTail.