-
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.
Remove the library and move attributes into generator.
And a few other changes: - Make dumping the tree optional as it's not necessary; - Remove dependency on external dependencies for the generator.
- Loading branch information
1 parent
677a95a
commit cf98c70
Showing
30 changed files
with
565 additions
and
482 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
80 changes: 0 additions & 80 deletions
80
...edGreen.SourceGenerator/Tsu.Trees.RedGreen.SourceGenerator.Generator/GreenNode.Debug.g.cs
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
...es.RedGreen.SourceGenerator/Tsu.Trees.RedGreen.SourceGenerator.Generator/Initialized.g.cs
This file was deleted.
Oops, something went wrong.
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
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
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
File renamed without changes.
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
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
31 changes: 0 additions & 31 deletions
31
Tsu.Trees.RedGreen/sourcegen/Tsu.Trees.RedGreen.SourceGenerator.csproj
This file was deleted.
Oops, something went wrong.
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,74 @@ | ||
namespace Tsu.Trees.RedGreen.SourceGenerator; | ||
|
||
internal static class Code | ||
{ | ||
public const string GreenNodeAttributeName = "Tsu.Trees.RedGreen.GreenNodeAttribute"; | ||
|
||
public const string GreenNodeAttributeCode = """ | ||
namespace Tsu.Trees.RedGreen; | ||
/// <summary> | ||
/// Marks this class as a green node. | ||
/// </summary> | ||
/// <param name="kinds"> | ||
/// The kinds this node could have. | ||
/// This should be the value on the enum (e.g.: SyntaxKind.ClassDeclarationSyntax) | ||
/// </param> | ||
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] | ||
internal sealed class GreenNodeAttribute(params object[] kinds) : Attribute | ||
{ | ||
/// <summary> | ||
/// This node's Kind. | ||
/// </summary> | ||
public object[] Kinds { get; } = kinds; | ||
} | ||
"""; | ||
|
||
public const string GreenTreeRootAttributeName = "Tsu.Trees.RedGreen.GreenTreeRootAttribute"; | ||
|
||
public const string GreenTreeRootAttributeCode = """ | ||
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)] | ||
internal sealed class GreenTreeRootAttribute(Type redBase, string suffix, Type kindEnum) : Attribute | ||
{ | ||
/// <summary> | ||
/// The suffix for nodes in this tree. | ||
/// </summary> | ||
public string Suffix { get; } = suffix; | ||
/// <summary> | ||
/// The base node type for all nodes in the red tree. | ||
/// </summary> | ||
public Type RedBase { get; } = redBase; | ||
/// <summary> | ||
/// The enum type that contains the definitions for the node kinds. | ||
/// </summary> | ||
public Type KindEnum { get; } = kindEnum; | ||
/// <summary> | ||
/// Whether to create base visitor implementations for this tree. | ||
/// </summary> | ||
public bool CreateVisitors { get; set; } | ||
/// <summary> | ||
/// Whether to create a base walker implementation for this tree. | ||
/// </summary> | ||
public bool CreateWalker { get; set; } | ||
/// <summary> | ||
/// Whether to generate a base rewriter implementation for this tree. | ||
/// </summary> | ||
public bool CreateRewriter { get; set; } | ||
/// <summary> | ||
/// Whether to generate a file with only comments dumping the entire tree structure. | ||
/// </summary> | ||
public bool DebugDump { get; set; } | ||
} | ||
"""; | ||
} |
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
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
Oops, something went wrong.