Skip to content

Commit

Permalink
make interpolated expression sequences great again
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdruppe committed Jun 12, 2024
1 parent 78f4ebf commit 9ddff7a
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions compiler/src/dmd/lexer.d
Original file line number Diff line number Diff line change
Expand Up @@ -1882,6 +1882,27 @@ class Lexer
// otherwise something like i"$(func("thing")) stuff" can still include it

return true;

case '_':
case 'a': .. case 'z':
case 'A': .. case 'Z':

// always put the string part in first
token.appendInterpolatedPart(stringbuffer);
stringbuffer.setsize(0);

// identifier, scan it with the lexer to follow all rules
auto pstart = p;
Token tok;
scan(&tok);

// then put the interpolated string segment
token.appendInterpolatedPart(pstart[0 .. p - pstart]);

stringbuffer.setsize(0);

return true;

default:
// nothing special
return false;
Expand Down

0 comments on commit 9ddff7a

Please sign in to comment.