Skip to content

Commit 2eb26c1

Browse files
committed
Remove support for $identifier inside IES
1 parent 5734017 commit 2eb26c1

File tree

4 files changed

+5
-48
lines changed

4 files changed

+5
-48
lines changed

src/dparse/ast.d

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ shared static this()
7575
typeMap[typeid(XorExpression)] = 48;
7676
typeMap[typeid(InterpolatedStringExpression)] = 49;
7777
typeMap[typeid(InterpolatedStringText)] = 50;
78-
typeMap[typeid(InterpolatedStringVariable)] = 51;
7978
}
8079

8180
/// Describes which syntax was used in a list of declarations in the containing AST node
@@ -170,7 +169,7 @@ abstract class ASTVisitor
170169
case 46: visit(cast(TypeofExpression) n); break;
171170
case 47: visit(cast(UnaryExpression) n); break;
172171
case 48: visit(cast(XorExpression) n); break;
173-
// skip 49, 50, 51 (used for InterpolatedStringPart)
172+
// skip 49, 50 (used for InterpolatedStringPart)
174173
default: assert(false, __MODULE__ ~ " has a bug");
175174
}
176175
}
@@ -182,7 +181,6 @@ abstract class ASTVisitor
182181
{
183182
case 49: visit(cast(InterpolatedStringExpression) n); break;
184183
case 50: visit(cast(InterpolatedStringText) n); break;
185-
case 51: visit(cast(InterpolatedStringVariable) n); break;
186184
default: assert(false, __MODULE__ ~ " has a bug");
187185
}
188186
}
@@ -308,7 +306,6 @@ abstract class ASTVisitor
308306
/** */ void visit(const InterpolatedString interpolatedString) { interpolatedString.accept(this); }
309307
/** */ void visit(const InterpolatedStringExpression interpolatedStringExpression) { interpolatedStringExpression.accept(this); }
310308
/** */ void visit(const InterpolatedStringText interpolatedStringText) { interpolatedStringText.accept(this); }
311-
/** */ void visit(const InterpolatedStringVariable interpolatedStringVariable) { interpolatedStringVariable.accept(this); }
312309
/** */ void visit(const Invariant invariant_) { invariant_.accept(this); }
313310
/** */ void visit(const IsExpression isExpression) { isExpression.accept(this); }
314311
/** */ void visit(const KeyValuePair keyValuePair) { keyValuePair.accept(this); }
@@ -2382,12 +2379,12 @@ final class InterpolatedString : BaseNode
23822379
mixin OpEquals!("startQuote.text", "postfixType");
23832380
}
23842381

2385-
///
2382+
/// AST nodes within an interpolated string
23862383
abstract class InterpolatedStringPart : BaseNode
23872384
{
23882385
}
23892386

2390-
///
2387+
/// Just plain text inside the interpolated string
23912388
final class InterpolatedStringText : InterpolatedStringPart
23922389
{
23932390
override void accept(ASTVisitor visitor) const
@@ -2403,29 +2400,7 @@ final class InterpolatedStringText : InterpolatedStringPart
24032400
mixin OpEquals!("text.text");
24042401
}
24052402

2406-
///
2407-
final class InterpolatedStringVariable : InterpolatedStringPart
2408-
{
2409-
override void accept(ASTVisitor visitor) const
2410-
{
2411-
}
2412-
2413-
/// The dollar token.
2414-
inout(Token) dollar() inout pure nothrow @nogc @safe scope
2415-
{
2416-
return tokens.length == 2 ? tokens[0] : Token.init;
2417-
}
2418-
2419-
/// The variable name token.
2420-
inout(Token) name() inout pure nothrow @nogc @safe scope
2421-
{
2422-
return tokens.length == 2 ? tokens[1] : Token.init;
2423-
}
2424-
2425-
mixin OpEquals!("name.text");
2426-
}
2427-
2428-
///
2403+
/// A $(...) interpolation sequence
24292404
final class InterpolatedStringExpression : InterpolatedStringPart
24302405
{
24312406
override void accept(ASTVisitor visitor) const

src/dparse/astprinter.d

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -599,11 +599,6 @@ class XMLPrinter : ASTVisitor
599599
output.writeln("<text>", xmlEscape(interpolatedStringText.text.text), "</text>");
600600
}
601601

602-
override void visit(const InterpolatedStringVariable interpolatedStringVariable)
603-
{
604-
output.writeln("<variable>", xmlEscape(interpolatedStringVariable.name.text), "</variable>");
605-
}
606-
607602
override void visit(const InterpolatedStringExpression interpolatedStringExpression)
608603
{
609604
visit(interpolatedStringExpression.expression);

src/dparse/formatter.d

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2019,7 +2019,6 @@ class Formatter(Sink)
20192019
foreach (part; interpolatedString.parts)
20202020
{
20212021
if (cast(InterpolatedStringText) part) format(cast(InterpolatedStringText) part);
2022-
else if (cast(InterpolatedStringVariable) part) format(cast(InterpolatedStringVariable) part);
20232022
else if (cast(InterpolatedStringExpression) part) format(cast(InterpolatedStringExpression) part);
20242023
}
20252024
put(interpolatedString.endQuote.text);
@@ -2030,12 +2029,6 @@ class Formatter(Sink)
20302029
put(interpolatedStringText.text.text);
20312030
}
20322031

2033-
void format(const InterpolatedStringVariable interpolatedStringVariable)
2034-
{
2035-
put("$");
2036-
put(interpolatedStringVariable.name.text);
2037-
}
2038-
20392032
void format(const InterpolatedStringExpression interpolatedStringExpression)
20402033
{
20412034
put("$(");

src/dparse/parser.d

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4674,13 +4674,7 @@ class Parser
46744674
}
46754675
else if (currentIs(tok!"$"))
46764676
{
4677-
if (peekIs(tok!"identifier"))
4678-
{
4679-
node = allocator.make!InterpolatedStringVariable;
4680-
advance();
4681-
advance();
4682-
}
4683-
else if (peekIs(tok!"("))
4677+
if (peekIs(tok!"("))
46844678
{
46854679
advance();
46864680
advance();

0 commit comments

Comments
 (0)