Skip to content

Commit 9ddff7a

Browse files
committed
make interpolated expression sequences great again
1 parent 78f4ebf commit 9ddff7a

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

compiler/src/dmd/lexer.d

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1882,6 +1882,27 @@ class Lexer
18821882
// otherwise something like i"$(func("thing")) stuff" can still include it
18831883

18841884
return true;
1885+
1886+
case '_':
1887+
case 'a': .. case 'z':
1888+
case 'A': .. case 'Z':
1889+
1890+
// always put the string part in first
1891+
token.appendInterpolatedPart(stringbuffer);
1892+
stringbuffer.setsize(0);
1893+
1894+
// identifier, scan it with the lexer to follow all rules
1895+
auto pstart = p;
1896+
Token tok;
1897+
scan(&tok);
1898+
1899+
// then put the interpolated string segment
1900+
token.appendInterpolatedPart(pstart[0 .. p - pstart]);
1901+
1902+
stringbuffer.setsize(0);
1903+
1904+
return true;
1905+
18851906
default:
18861907
// nothing special
18871908
return false;

0 commit comments

Comments
 (0)