-
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.
Update sample with the current generator output.
- Loading branch information
1 parent
a828beb
commit 85f78fb
Showing
4 changed files
with
184 additions
and
4 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
...edGreen.SourceGenerator/Tsu.Trees.RedGreen.SourceGenerator.Generator/GreenNode.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,38 @@ | ||
// 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 | ||
// Children: | ||
// ExtraData: | ||
// global::Tsu.Trees.RedGreen.Sample.SampleKind (Name = _kind, IsOptional = False, PassToBase = False) | ||
// global::Tsu.Trees.RedGreen.Sample.Internal.ExpressionSample | ||
// Children: | ||
// ExtraData: | ||
// global::Tsu.Trees.RedGreen.Sample.SampleKind (Name = _kind, IsOptional = False, PassToBase = True) | ||
// global::Tsu.Trees.RedGreen.Sample.Internal.FunctionCallExpressionSample | ||
// Children: | ||
// global::Tsu.Trees.RedGreen.Sample.Internal.IdentifierExpressionSample (Name = identifier, IsOptional = False, PassToBase = False) | ||
// global::Tsu.Trees.RedGreen.Sample.Internal.ExpressionSample (Name = firstArg, IsOptional = False, PassToBase = False) | ||
// global::Tsu.Trees.RedGreen.Sample.Internal.ExpressionSample (Name = secondArg, IsOptional = True, PassToBase = False) | ||
// ExtraData: | ||
// global::Tsu.Trees.RedGreen.Sample.SampleKind (Name = _kind, IsOptional = False, PassToBase = True) | ||
// global::Tsu.Trees.RedGreen.Sample.Internal.BinaryOperationExpressionSample | ||
// Children: | ||
// global::Tsu.Trees.RedGreen.Sample.Internal.ExpressionSample (Name = _left, IsOptional = False, PassToBase = False) | ||
// global::Tsu.Trees.RedGreen.Sample.Internal.ExpressionSample (Name = _right, IsOptional = False, PassToBase = False) | ||
// ExtraData: | ||
// global::Tsu.Trees.RedGreen.Sample.SampleKind (Name = _kind, IsOptional = False, PassToBase = True) | ||
// global::Tsu.Trees.RedGreen.Sample.Internal.NumericalLiteralExpressionSample | ||
// Children: | ||
// ExtraData: | ||
// global::Tsu.Trees.RedGreen.Sample.SampleKind (Name = _kind, IsOptional = False, PassToBase = True) | ||
// double (Name = _value, IsOptional = False, PassToBase = False) | ||
// global::Tsu.Trees.RedGreen.Sample.Internal.IdentifierExpressionSample | ||
// Children: | ||
// ExtraData: | ||
// global::Tsu.Trees.RedGreen.Sample.SampleKind (Name = _kind, IsOptional = False, PassToBase = True) | ||
// string (Name = _name, IsOptional = False, PassToBase = False) |
1 change: 1 addition & 0 deletions
1
...es.RedGreen.SourceGenerator/Tsu.Trees.RedGreen.SourceGenerator.Generator/Initialized.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 @@ | ||
// <auto-generated /> |
140 changes: 140 additions & 0 deletions
140
...edGreen.SourceGenerator/Tsu.Trees.RedGreen.SourceGenerator.Generator/Sample.Internal.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,140 @@ | ||
// <auto-generated /> | ||
|
||
using System.Diagnostics; | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Linq; | ||
|
||
namespace Tsu.Trees.RedGreen.Sample.Internal | ||
{ | ||
abstract partial class GreenNode : global::Tsu.Trees.RedGreen.Internal.IGreenNode<global::Tsu.Trees.RedGreen.Sample.Internal.GreenNode, global::Tsu.Trees.RedGreen.Sample.SampleNode, global::Tsu.Trees.RedGreen.Sample.SampleKind> | ||
{ | ||
private readonly global::Tsu.Trees.RedGreen.Sample.SampleKind _kind; | ||
private byte _slotCount; | ||
|
||
protected GreenNode(global::Tsu.Trees.RedGreen.Sample.SampleKind kind) | ||
{ | ||
this._kind = kind; | ||
} | ||
|
||
public global::Tsu.Trees.RedGreen.Sample.SampleKind Kind => this._kind; | ||
|
||
public int SlotCount | ||
{ | ||
get | ||
{ | ||
int count = this._slotCount; | ||
if (count == byte.MaxValue) | ||
count = this.GetSlotCount(); | ||
return count; | ||
} | ||
protected set => _slotCount = (byte) value; | ||
} | ||
|
||
public abstract global::Tsu.Trees.RedGreen.Sample.Internal.GreenNode? GetSlot(int slot); | ||
|
||
public global::Tsu.Trees.RedGreen.Sample.Internal.GreenNode GetRequiredSlot(int slot) | ||
{ | ||
var node = this.GetSlot(slot); | ||
Debug.Assert((object)node != null) | ||
return node; | ||
} | ||
|
||
protected virtual int GetSlotCount() => _slotCount; | ||
|
||
public global::System.Collections.Generic.IEnumerable<global::Tsu.Trees.RedGreen.Sample.Internal.GreenNode> ChildNodes() | ||
{ | ||
var count = this.SlotCount; | ||
for (var slot = 0; slot < count; slot++) | ||
yield return this.GetRequiredSlot(slot); | ||
} | ||
|
||
public global::System.Collections.Generic.IEnumerable<global::Tsu.Trees.RedGreen.Sample.Internal.GreenNode> EnumerateDescendants() | ||
{ | ||
var stack = new Stack<global::Tsu.Trees.RedGreen.Sample.Internal.GreenNode>(24); | ||
stack.Push(this); | ||
|
||
while (stack.Count > 0) | ||
{ | ||
var current = stack.Pop(); | ||
|
||
yield return current; | ||
|
||
foreach (var child in current.ChildNodes().Reverse()) | ||
{ | ||
stack.Push(child); | ||
} | ||
} | ||
} | ||
|
||
public virtual bool IsEquivalentTo([NotNullWhen(true)] global::Tsu.Trees.RedGreen.Sample.Internal.GreenNode? other) | ||
{ | ||
if (this == other) return true; | ||
if (other == null) return false; | ||
if (this.Kind != other.Kind) return false; | ||
var n = this.SlotCount; | ||
if (n != other.SlotCount) return false; | ||
|
||
for (int i = 0; i < n; i++) | ||
{ | ||
var thisChild = this.GetSlot(i); | ||
var otherChild = other.GetSlot(i); | ||
if (thisChild != null && otherChild != null && !thisChild.IsEquivalentTo(otherChild)) | ||
{ | ||
return false; | ||
} | ||
} | ||
|
||
return true; | ||
} | ||
|
||
public global::Tsu.Trees.RedGreen.Sample.SampleNode CreateRed() => this.CreateRed(null); | ||
public abstract global::Tsu.Trees.RedGreen.Sample.SampleNode CreateRed(global::Tsu.Trees.RedGreen.Sample.SampleNode? parent); | ||
} | ||
|
||
abstract partial class ExpressionSample : global::Tsu.Trees.RedGreen.Sample.Internal.GreenNode | ||
{ | ||
protected ExpressionSample(global::Tsu.Trees.RedGreen.Sample.SampleKind kind) : base(kind) | ||
{ | ||
} | ||
} | ||
|
||
partial class IdentifierExpressionSample : global::Tsu.Trees.RedGreen.Sample.Internal.ExpressionSample | ||
{ | ||
internal IdentifierExpressionSample(global::Tsu.Trees.RedGreen.Sample.SampleKind kind, string name) : base(kind) | ||
{ | ||
this.SlotCount = 0; | ||
this._name = name; | ||
} | ||
} | ||
|
||
partial class NumericalLiteralExpressionSample : global::Tsu.Trees.RedGreen.Sample.Internal.ExpressionSample | ||
{ | ||
internal NumericalLiteralExpressionSample(global::Tsu.Trees.RedGreen.Sample.SampleKind kind, double value) : base(kind) | ||
{ | ||
this.SlotCount = 0; | ||
this._value = value; | ||
} | ||
} | ||
|
||
partial class BinaryOperationExpressionSample : global::Tsu.Trees.RedGreen.Sample.Internal.ExpressionSample | ||
{ | ||
internal BinaryOperationExpressionSample(global::Tsu.Trees.RedGreen.Sample.SampleKind kind, global::Tsu.Trees.RedGreen.Sample.Internal.ExpressionSample left, global::Tsu.Trees.RedGreen.Sample.Internal.ExpressionSample right) : base(kind) | ||
{ | ||
this.SlotCount = 2; | ||
this._left = left; | ||
this._right = right; | ||
} | ||
} | ||
|
||
partial class FunctionCallExpressionSample : global::Tsu.Trees.RedGreen.Sample.Internal.ExpressionSample | ||
{ | ||
internal FunctionCallExpressionSample(global::Tsu.Trees.RedGreen.Sample.SampleKind kind, global::Tsu.Trees.RedGreen.Sample.Internal.IdentifierExpressionSample identifier, global::Tsu.Trees.RedGreen.Sample.Internal.ExpressionSample firstArg, global::Tsu.Trees.RedGreen.Sample.Internal.ExpressionSample secondArg) : base(kind) | ||
{ | ||
this.SlotCount = 3; | ||
this.identifier = identifier; | ||
this.firstArg = firstArg; | ||
this.secondArg = secondArg; | ||
} | ||
} | ||
} | ||
|
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