Actually, let's back up a step. How does it do nesting at all? You say the language keyword is optional, so the starting and ending delimiters are exactly the same. The other constructs which support nesting all have distinct starting and ending delimiters so the lexer can keep a depth count (or stack or something; I've never looked at the implementation). It can't be indentation-sensitive, because the indentation would have to come from the ending delimiter, and the indentation of the first ending delimiter it encountered would always appear to be fine. So can you explain, at the level of a lexer looking at a pointer into a byte view of UTF-8 source code, how you'd parse this syntax?
1 Like