So lexers are supposed to emit tokens for key structures like INDENT and DEDENT for indentation stuff, or these:
NUMBER ::= [0-9]+
ID ::= [a-Z]+, except for keywords
IF ::= 'if'
LPAREN ::= '('
RPAREN ::= ')'
COMMA ::= ','
LBRACE ::= '{'
RBRACE ::= '}'
SEMICOLON ::= ';'
What does it do for template strings like in JavaScript:
`I am a ${simple} template string!`
`I am a ${complex ? `nested ${simple}` : 'basic'} template string!`
What are the lexer tokens for such strings? How does it handle the regular part of the string vs. the variable part, and how generally does the lexer parse this code to emit its tokens?
The template string has both string components, and arbitrarily deeply nested recursion of code/template/code/template/etc. How does the lexer know what to do?