-
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
Showing
85 changed files
with
6,273 additions
and
1,977 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
...ted/Tsu.Trees.RedGreen/Tsu.Trees.RedGreen.SourceGenerator.Generator/GreenListAttribute.cs
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,13 @@ | ||
namespace Tsu.Trees.RedGreen; | ||
|
||
/// <summary> | ||
/// Marks this field as a green list of nodes of the specified type. | ||
/// </summary> | ||
[global::System.AttributeUsage(AttributeTargets.Field, Inherited = false, AllowMultiple = false)] | ||
internal sealed class GreenListAttribute(global::System.Type elementType) : global::System.Attribute | ||
{ | ||
/// <summary> | ||
/// The type of element in this List. | ||
/// </summary> | ||
public global::System.Type ElementType { get; } = elementType; | ||
} |
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
13 changes: 13 additions & 0 deletions
13
...Tsu.Trees.RedGreen/Tsu.Trees.RedGreen.SourceGenerator.Generator/NodeComponentAttribute.cs
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,13 @@ | ||
namespace Tsu.Trees.RedGreen; | ||
|
||
/// <summary> | ||
/// Enabled configuring a child node's properties | ||
/// </summary> | ||
[global::System.AttributeUsage(AttributeTargets.Field, Inherited = false, AllowMultiple = false)] | ||
internal sealed class NodeComponentAttribute() : global::System.Attribute | ||
{ | ||
/// <summary> | ||
/// Allows the order that this child appears in prefix order (and by consequence, constructors, factories and update methods). | ||
/// </summary> | ||
public int Order { get; set; } | ||
} |
525 changes: 0 additions & 525 deletions
525
...ated/Tsu.Trees.RedGreen/Tsu.Trees.RedGreen.SourceGenerator.Generator/Sample.Internal.g.cs
This file was deleted.
Oops, something went wrong.
473 changes: 0 additions & 473 deletions
473
...Generated/Tsu.Trees.RedGreen/Tsu.Trees.RedGreen.SourceGenerator.Generator/Sample.Red.g.cs
This file was deleted.
Oops, something went wrong.
89 changes: 89 additions & 0 deletions
89
...nerated/Tsu.Trees.RedGreen/Tsu.Trees.RedGreen.SourceGenerator.Generator/Sample/Debug.g.cs
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,89 @@ | ||
// GreenBase = global::Tsu.Trees.RedGreen.Sample.Internal.GreenNode | ||
// RedBase = global::Tsu.Trees.RedGreen.Sample.SampleNode | ||
// KindEnum = global::Tsu.Trees.RedGreen.Sample.SampleKind | ||
// CreateVisitors = True | ||
// CreateWalker = True | ||
// CreateRewriter = True | ||
// Root = global::Tsu.Trees.RedGreen.Sample.Internal.GreenNode | ||
// global::Tsu.Trees.RedGreen.Sample.Internal.GreenNode | ||
// Kinds: | ||
// Children: | ||
// ExtraData: | ||
// global::Tsu.Trees.RedGreen.Sample.SampleKind (IsList = False, Name = _kind, IsOptional = False, PassToBase = False, Order = 0) | ||
// Descendants: | ||
// global::Tsu.Trees.RedGreen.Sample.Internal.ExpressionSample | ||
// Kinds: | ||
// Children: | ||
// ExtraData: | ||
// global::Tsu.Trees.RedGreen.Sample.SampleKind (IsList = False, Name = _kind, IsOptional = False, PassToBase = True, Order = 0) | ||
// Descendants: | ||
// global::Tsu.Trees.RedGreen.Sample.Internal.FunctionCallExpressionSample | ||
// Kinds: | ||
// Tsu.Trees.RedGreen.Sample.SampleKind.FunctionCallExpression (IsNull = False, Type = global::Tsu.Trees.RedGreen.Sample.SampleKind, Value = 9) | ||
// Children: | ||
// global::Tsu.Trees.RedGreen.Sample.Internal.IdentifierExpressionSample (IsList = False, Name = _identifier, IsOptional = False, PassToBase = False, Order = 1) | ||
// global::Tsu.Trees.RedGreen.Sample.Internal.ExpressionSample (IsList = True, Name = _args, IsOptional = False, PassToBase = False, Order = 2) | ||
// ExtraData: | ||
// global::Tsu.Trees.RedGreen.Sample.SampleKind (IsList = False, Name = _kind, IsOptional = False, PassToBase = True, Order = 0) | ||
// Descendants: | ||
// global::Tsu.Trees.RedGreen.Sample.Internal.BinaryOperationExpressionSample | ||
// Kinds: | ||
// Tsu.Trees.RedGreen.Sample.SampleKind.AdditionExpression (IsNull = False, Type = global::Tsu.Trees.RedGreen.Sample.SampleKind, Value = 5) | ||
// Tsu.Trees.RedGreen.Sample.SampleKind.DivisionExpression (IsNull = False, Type = global::Tsu.Trees.RedGreen.Sample.SampleKind, Value = 8) | ||
// Tsu.Trees.RedGreen.Sample.SampleKind.MultiplicationExpression (IsNull = False, Type = global::Tsu.Trees.RedGreen.Sample.SampleKind, Value = 7) | ||
// Tsu.Trees.RedGreen.Sample.SampleKind.SubtractionExpression (IsNull = False, Type = global::Tsu.Trees.RedGreen.Sample.SampleKind, Value = 6) | ||
// Children: | ||
// global::Tsu.Trees.RedGreen.Sample.Internal.ExpressionSample (IsList = False, Name = _left, IsOptional = False, PassToBase = False, Order = 1) | ||
// global::Tsu.Trees.RedGreen.Sample.Internal.ExpressionSample (IsList = False, Name = _right, IsOptional = False, PassToBase = False, Order = 2) | ||
// ExtraData: | ||
// global::Tsu.Trees.RedGreen.Sample.SampleKind (IsList = False, Name = _kind, IsOptional = False, PassToBase = True, Order = 0) | ||
// Descendants: | ||
// global::Tsu.Trees.RedGreen.Sample.Internal.NumericalLiteralExpressionSample | ||
// Kinds: | ||
// Tsu.Trees.RedGreen.Sample.SampleKind.NumericalLiteralExpression (IsNull = False, Type = global::Tsu.Trees.RedGreen.Sample.SampleKind, Value = 4) | ||
// Children: | ||
// ExtraData: | ||
// global::Tsu.Trees.RedGreen.Sample.SampleKind (IsList = False, Name = _kind, IsOptional = False, PassToBase = True, Order = 0) | ||
// double (IsList = False, Name = _value, IsOptional = False, PassToBase = False, Order = 1) | ||
// Descendants: | ||
// global::Tsu.Trees.RedGreen.Sample.Internal.IdentifierExpressionSample | ||
// Kinds: | ||
// Tsu.Trees.RedGreen.Sample.SampleKind.IdentifierExpression (IsNull = False, Type = global::Tsu.Trees.RedGreen.Sample.SampleKind, Value = 3) | ||
// Children: | ||
// ExtraData: | ||
// global::Tsu.Trees.RedGreen.Sample.SampleKind (IsList = False, Name = _kind, IsOptional = False, PassToBase = True, Order = 0) | ||
// string (IsList = False, Name = _name, IsOptional = False, PassToBase = False, Order = 1) | ||
// Descendants: | ||
// global::Tsu.Trees.RedGreen.Sample.Internal.StatementSample | ||
// Kinds: | ||
// Children: | ||
// global::Tsu.Trees.RedGreen.Sample.Internal.SemicolonTokenSample (IsList = False, Name = _semicolon, IsOptional = False, PassToBase = False, Order = -1) | ||
// ExtraData: | ||
// global::Tsu.Trees.RedGreen.Sample.SampleKind (IsList = False, Name = _kind, IsOptional = False, PassToBase = True, Order = 0) | ||
// Descendants: | ||
// global::Tsu.Trees.RedGreen.Sample.Internal.ExpressionStatementSample | ||
// Kinds: | ||
// Tsu.Trees.RedGreen.Sample.SampleKind.ExpressionStatement (IsNull = False, Type = global::Tsu.Trees.RedGreen.Sample.SampleKind, Value = 11) | ||
// Children: | ||
// global::Tsu.Trees.RedGreen.Sample.Internal.ExpressionSample (IsList = False, Name = _expression, IsOptional = False, PassToBase = False, Order = 1) | ||
// global::Tsu.Trees.RedGreen.Sample.Internal.SemicolonTokenSample (IsList = False, Name = _semicolon, IsOptional = False, PassToBase = True, Order = -1) | ||
// ExtraData: | ||
// global::Tsu.Trees.RedGreen.Sample.SampleKind (IsList = False, Name = _kind, IsOptional = False, PassToBase = True, Order = 0) | ||
// Descendants: | ||
// global::Tsu.Trees.RedGreen.Sample.Internal.AssignmentStatement | ||
// Kinds: | ||
// Tsu.Trees.RedGreen.Sample.SampleKind.AssignmentStatement (IsNull = False, Type = global::Tsu.Trees.RedGreen.Sample.SampleKind, Value = 10) | ||
// Children: | ||
// global::Tsu.Trees.RedGreen.Sample.Internal.IdentifierExpressionSample (IsList = False, Name = _identifier, IsOptional = False, PassToBase = False, Order = 1) | ||
// global::Tsu.Trees.RedGreen.Sample.Internal.ExpressionSample (IsList = False, Name = _value, IsOptional = False, PassToBase = False, Order = 2) | ||
// global::Tsu.Trees.RedGreen.Sample.Internal.SemicolonTokenSample (IsList = False, Name = _semicolon, IsOptional = False, PassToBase = True, Order = -1) | ||
// ExtraData: | ||
// global::Tsu.Trees.RedGreen.Sample.SampleKind (IsList = False, Name = _kind, IsOptional = False, PassToBase = True, Order = 0) | ||
// Descendants: | ||
// global::Tsu.Trees.RedGreen.Sample.Internal.SemicolonTokenSample | ||
// Kinds: | ||
// Tsu.Trees.RedGreen.Sample.SampleKind.SemicolonToken (IsNull = False, Type = global::Tsu.Trees.RedGreen.Sample.SampleKind, Value = 2) | ||
// Children: | ||
// ExtraData: | ||
// global::Tsu.Trees.RedGreen.Sample.SampleKind (IsList = False, Name = _kind, IsOptional = False, PassToBase = True, Order = 0) | ||
// Descendants: |
95 changes: 95 additions & 0 deletions
95
...u.Trees.RedGreen.SourceGenerator.Generator/Sample/Internal/ChildGreenList.Enumerator.g.cs
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,95 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// Modified by the Tsu (https://github.com/GGG-KILLER/Tsu) project for embedding into other projects. | ||
// <auto-generated /> | ||
|
||
#nullable enable | ||
|
||
namespace Tsu.Trees.RedGreen.Sample.Internal | ||
{ | ||
internal partial struct ChildSampleList | ||
{ | ||
internal struct Enumerator | ||
{ | ||
private readonly global::Tsu.Trees.RedGreen.Sample.Internal.GreenNode? _node; | ||
private int _childIndex; | ||
private global::Tsu.Trees.RedGreen.Sample.Internal.GreenNode? _list; | ||
private int _listIndex; | ||
private global::Tsu.Trees.RedGreen.Sample.Internal.GreenNode? _currentChild; | ||
|
||
internal Enumerator(global::Tsu.Trees.RedGreen.Sample.Internal.GreenNode? node) | ||
{ | ||
_node = node; | ||
_childIndex = -1; | ||
_listIndex = -1; | ||
_list = null; | ||
_currentChild = null; | ||
} | ||
|
||
public bool MoveNext() | ||
{ | ||
if (_node != null) | ||
{ | ||
if (_list != null) | ||
{ | ||
_listIndex++; | ||
|
||
if (_listIndex < _list.SlotCount) | ||
{ | ||
_currentChild = _list.GetSlot(_listIndex); | ||
return true; | ||
} | ||
|
||
_list = null; | ||
_listIndex = -1; | ||
} | ||
|
||
while (true) | ||
{ | ||
_childIndex++; | ||
|
||
if (_childIndex == _node.SlotCount) | ||
{ | ||
break; | ||
} | ||
|
||
var child = _node.GetSlot(_childIndex); | ||
if (child == null) | ||
{ | ||
continue; | ||
} | ||
|
||
if (child.Kind == global::Tsu.Trees.RedGreen.Sample.Internal.GreenNode.ListKind) | ||
{ | ||
_list = child; | ||
_listIndex++; | ||
|
||
if (_listIndex < _list.SlotCount) | ||
{ | ||
_currentChild = _list.GetSlot(_listIndex); | ||
return true; | ||
} | ||
else | ||
{ | ||
_list = null; | ||
_listIndex = -1; | ||
continue; | ||
} | ||
} | ||
else | ||
{ | ||
_currentChild = child; | ||
} | ||
|
||
return true; | ||
} | ||
} | ||
|
||
_currentChild = null; | ||
return false; | ||
} | ||
|
||
public global::Tsu.Trees.RedGreen.Sample.Internal.GreenNode Current => _currentChild!; | ||
} | ||
} | ||
} |
98 changes: 98 additions & 0 deletions
98
...edGreen.SourceGenerator.Generator/Sample/Internal/ChildGreenList.Reversed.Enumerator.g.cs
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,98 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// Modified by the Tsu (https://github.com/GGG-KILLER/Tsu) project for embedding into other projects. | ||
// <auto-generated /> | ||
|
||
#nullable enable | ||
|
||
namespace Tsu.Trees.RedGreen.Sample.Internal | ||
{ | ||
internal partial struct ChildSampleList | ||
{ | ||
internal partial struct Reversed | ||
{ | ||
internal struct Enumerator | ||
{ | ||
private readonly global::Tsu.Trees.RedGreen.Sample.Internal.GreenNode? _node; | ||
private int _childIndex; | ||
private global::Tsu.Trees.RedGreen.Sample.Internal.GreenNode? _list; | ||
private int _listIndex; | ||
private global::Tsu.Trees.RedGreen.Sample.Internal.GreenNode? _currentChild; | ||
|
||
internal Enumerator(global::Tsu.Trees.RedGreen.Sample.Internal.GreenNode? node) | ||
{ | ||
if (node != null) | ||
{ | ||
_node = node; | ||
_childIndex = node.SlotCount; | ||
_listIndex = -1; | ||
} | ||
else | ||
{ | ||
_node = null; | ||
_childIndex = 0; | ||
_listIndex = -1; | ||
} | ||
|
||
_list = null; | ||
_currentChild = null; | ||
} | ||
|
||
public bool MoveNext() | ||
{ | ||
if (_node != null) | ||
{ | ||
if (_list != null) | ||
{ | ||
if (--_listIndex >= 0) | ||
{ | ||
_currentChild = _list.GetSlot(_listIndex); | ||
return true; | ||
} | ||
|
||
_list = null; | ||
_listIndex = -1; | ||
} | ||
|
||
while (--_childIndex >= 0) | ||
{ | ||
var child = _node.GetSlot(_childIndex); | ||
if (child == null) | ||
{ | ||
continue; | ||
} | ||
|
||
if (child.IsList) | ||
{ | ||
_list = child; | ||
_listIndex = _list.SlotCount; | ||
if (--_listIndex >= 0) | ||
{ | ||
_currentChild = _list.GetSlot(_listIndex); | ||
return true; | ||
} | ||
else | ||
{ | ||
_list = null; | ||
_listIndex = -1; | ||
continue; | ||
} | ||
} | ||
else | ||
{ | ||
_currentChild = child; | ||
} | ||
|
||
return true; | ||
} | ||
} | ||
|
||
_currentChild = null; | ||
return false; | ||
} | ||
|
||
public global::Tsu.Trees.RedGreen.Sample.Internal.GreenNode Current => _currentChild!; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.