2024-08-16 17:07:53 +08:00
|
|
|
|
using CanonSharp.Pascal.Scanner;
|
|
|
|
|
|
|
|
|
|
namespace CanonSharp.Pascal.SyntaxTree;
|
|
|
|
|
|
2024-08-17 17:50:28 +08:00
|
|
|
|
public record struct ArrayRange(int Left, int Right);
|
|
|
|
|
|
|
|
|
|
public sealed class TypeNode : SyntaxNodeBase
|
2024-08-16 17:07:53 +08:00
|
|
|
|
{
|
|
|
|
|
public override SyntaxNodeType NodeType => SyntaxNodeType.Type;
|
|
|
|
|
|
2024-08-17 17:50:28 +08:00
|
|
|
|
public LexicalToken TypeToken { get; }
|
|
|
|
|
|
|
|
|
|
public List<ArrayRange> ArrayRanges { get; } = [];
|
|
|
|
|
|
|
|
|
|
public TypeNode(LexicalToken typeToken)
|
|
|
|
|
{
|
|
|
|
|
TypeToken = typeToken;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public TypeNode(LexicalToken typeToken, IEnumerable<ArrayRange> arrayRanges) : this(typeToken)
|
|
|
|
|
{
|
|
|
|
|
ArrayRanges.AddRange(arrayRanges);
|
|
|
|
|
}
|
2024-08-16 17:07:53 +08:00
|
|
|
|
}
|