Skip to content

Commit 496ed47

Browse files
committed
support i", i`, iq{ and istring postfixes
1 parent 3c665c0 commit 496ed47

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/dparse/ast.d

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2363,7 +2363,23 @@ final class InterpolatedString : BaseNode
23632363
: Token.init;
23642364
}
23652365

2366-
mixin OpEquals!("startQuote.text");
2366+
/// '\0'/'c'/'w'/'d' for `i""`, `i""c`, `i""w` and `i""d` respectively.
2367+
char postfixType() inout pure nothrow @nogc @safe scope
2368+
{
2369+
auto end = endQuote.text;
2370+
auto endChar = end.length ? end[$ - 1] : ' ';
2371+
switch (endChar)
2372+
{
2373+
case 'c':
2374+
case 'w':
2375+
case 'd':
2376+
return endChar;
2377+
default:
2378+
return '\0';
2379+
}
2380+
}
2381+
2382+
mixin OpEquals!("startQuote.text", "postfixType");
23672383
}
23682384

23692385
///

0 commit comments

Comments
 (0)