-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
59 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
namespace RobloxCS.Luau | ||
{ | ||
public class InterpolatedString : Expression | ||
{ | ||
public List<Expression> Parts { get; } | ||
|
||
public InterpolatedString(List<Expression> parts) | ||
{ | ||
Parts = parts; | ||
AddChildren(Parts); | ||
} | ||
|
||
public override void Render(LuauWriter luau) | ||
{ | ||
luau.Write('`'); | ||
foreach (var part in Parts) | ||
part.Render(luau); | ||
|
||
luau.Write('`'); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
namespace RobloxCS.Luau; | ||
|
||
/// <summary> | ||
/// An interpolated section of an <see cref="InterpolatedString"/> | ||
/// </summary> | ||
public class Interpolation : Expression | ||
{ | ||
public Expression Expression { get; } | ||
|
||
public Interpolation(Expression expression) | ||
{ | ||
Expression = expression; | ||
AddChild(Expression); | ||
} | ||
|
||
public override void Render(LuauWriter luau) | ||
{ | ||
luau.Write('{'); | ||
Expression.Render(luau); | ||
luau.Write('}'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,9 @@ | ||
namespace RobloxCS.Luau | ||
{ | ||
public class Literal : Expression | ||
public class Literal(string valueText) : Expression | ||
{ | ||
public string ValueText { get; } | ||
public string ValueText { get; } = valueText; | ||
|
||
public Literal(string valueText) | ||
{ | ||
ValueText = valueText; | ||
} | ||
|
||
public override void Render(LuauWriter luau) | ||
{ | ||
luau.Write(ValueText); | ||
} | ||
public override void Render(LuauWriter luau) => luau.Write(ValueText); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters