using System.Collections.Generic; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// /// interpolated_string_expression ::= interpolated_string_content* (C# grammar §12.8.3) /// [DecompilerAstNode(hasNullNode: false)] public partial class InterpolatedStringExpression : Expression { public static readonly TokenRole OpenQuote = new TokenRole("$\""); public static readonly TokenRole CloseQuote = new TokenRole("\""); [Slot("InterpolatedStringContent.Role")] public partial AstNodeCollection Content { get; } public InterpolatedStringExpression() { } public InterpolatedStringExpression(IList content) { Content.AddRange(content); } } /// /// /// interpolated_string_content ::= /// interpolation /// | interpolated_string_text /// /// (C# grammar §12.8.3) /// [DecompilerAstNode(hasNullNode: true)] public abstract partial class InterpolatedStringContent : AstNode { public new static readonly Role Role = new Role("InterpolatedStringContent", Syntax.InterpolatedStringContent.Null); } /// /// interpolation ::= '{' expression ( ',' alignment )? ( ':' format )? '}' (C# grammar §12.8.3) /// [DecompilerAstNode(hasNullNode: false)] public partial class Interpolation : InterpolatedStringContent { public static readonly TokenRole LBrace = new TokenRole("{"); public static readonly TokenRole RBrace = new TokenRole("}"); [Slot("Roles.Expression")] public partial Expression Expression { get; set; } public int Alignment { get; } public string Suffix { get; } public Interpolation() { } public Interpolation(Expression expression, int alignment = 0, string suffix = null) { Expression = expression; Alignment = alignment; Suffix = suffix; } } /// /// interpolated_string_text ::= text_character+ (C# lexical grammar §12.8.3) /// [DecompilerAstNode(hasNullNode: false)] public partial class InterpolatedStringText : InterpolatedStringContent { public string Text { get; set; } public InterpolatedStringText() { } public InterpolatedStringText(string text) { Text = text; } } }