-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
84789bd
commit 65d54cb
Showing
3 changed files
with
67 additions
and
0 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,16 @@ | ||
namespace Tsu.Trees.RedGreen; | ||
|
||
/// <summary> | ||
/// Indicates this field/property stores a child node. | ||
/// </summary> | ||
/// <remarks> | ||
/// This is used in generation of GetChildren and GetSlot. | ||
/// </remarks> | ||
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, Inherited = false, AllowMultiple = false)] | ||
public sealed class ChildAttribute : Attribute | ||
{ | ||
/// <summary> | ||
/// The override for the slot of this child. | ||
/// </summary> | ||
public int? Slot { get; } | ||
} |
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,17 @@ | ||
namespace Tsu.Trees.RedGreen; | ||
|
||
/// <summary> | ||
/// Overrides the kind for a given green node. | ||
/// </summary> | ||
/// <param name="kind"> | ||
/// The value of the kind this node should have. | ||
/// This should be the value on the enum (e.g.: SyntaxKind.ClassDeclarationSyntax) | ||
/// </param> | ||
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] | ||
public sealed class GreenNodeKindAttribute(object kind) : Attribute | ||
{ | ||
/// <summary> | ||
/// This node's Kind. | ||
/// </summary> | ||
public object Kind { get; } = kind; | ||
} |
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,34 @@ | ||
namespace Tsu.Trees.RedGreen; | ||
|
||
/// <summary> | ||
/// An attribute that marks the given class as the base class for all nodes in a green node tree. | ||
/// </summary> | ||
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] | ||
public sealed class GreenNodeRootAttribute(string listName, Type redRoot) : Attribute | ||
{ | ||
/// <summary> | ||
/// The name of the list type for this green tree. | ||
/// </summary> | ||
public string ListName { get; } = listName; | ||
|
||
/// <summary> | ||
/// The base node type for all nodes in the red tree. | ||
/// </summary> | ||
public Type RedBase { get; } = redRoot; | ||
|
||
/// <summary> | ||
/// The enum type that contains the definitions for the node kinds. | ||
/// </summary> | ||
public Type? KindEnum { get; set; } | ||
|
||
// NOTE: Make cache configurable? | ||
// /// <summary> | ||
// /// Whether to enable the green cache or not. | ||
// /// </summary> | ||
// public bool CacheEnabled { get; set; } = true; | ||
|
||
// /// <summary> | ||
// /// The amount of bits from the hash to use for caching. | ||
// /// </summary> | ||
// public int CacheSizeBits { get; set; } = 16; | ||
} |