Pipe Parameter is now a Tuple

This commit is contained in:
Michael Schimmel
2026-01-05 00:13:51 +01:00
parent 242ec9a56e
commit 264314cd93
15 changed files with 322 additions and 1244 deletions
+6 -46
View File
@@ -15,7 +15,7 @@ uses
type
// Implementation of the Factory/Visitor for the Virtual Tree
// Uses TAstVisitor<TAstViewNode> which now uses closures for dispatch.
// Uses TAstVisitor<TAstViewNode> which uses closures for dispatch.
TAstVisualizer = class(TAstVisitor<TAstViewNode>, IAstVisualizer)
private
FExprDepth: Integer;
@@ -77,9 +77,6 @@ type
function VisitSeriesLength(const Node: IAstNode): TAstViewNode;
// Pipes
function VisitPipeInput(const Node: IAstNode): TAstViewNode;
function VisitPipeSelectorList(const Node: IAstNode): TAstViewNode;
function VisitPipeInputList(const Node: IAstNode): TAstViewNode;
function VisitPipe(const Node: IAstNode): TAstViewNode;
public
@@ -101,7 +98,8 @@ uses
Myc.Fmx.AstEditor.Handlers.Data,
Myc.Fmx.AstEditor.Handlers.Control,
Myc.Fmx.AstEditor.Handlers.Primitives,
Myc.Fmx.AstEditor.Handlers.Lists;
Myc.Fmx.AstEditor.Handlers.Lists,
Myc.Fmx.AstEditor.Handlers.Pipes;
function IsStandardOperator(const Name: string): Boolean;
begin
@@ -166,10 +164,7 @@ begin
Register(akAddSeriesItem, VisitAddSeriesItem);
Register(akSeriesLength, VisitSeriesLength);
// Pipes
Register(akPipeInput, VisitPipeInput);
Register(akPipeSelectorList, VisitPipeSelectorList);
Register(akPipeInputList, VisitPipeInputList);
// Pipes (Simplified)
Register(akPipe, VisitPipe);
end;
@@ -208,7 +203,7 @@ begin
Result := FWorkspace;
end;
// --- Visitor Implementations (Cast-heavy for efficiency) ---
// --- Visitor Implementations ---
function TAstVisualizer.VisitConstant(const Node: IAstNode): TAstViewNode;
begin
@@ -230,8 +225,6 @@ begin
Result := TAstViewNode.Create(Self, TNopNodeHandler.Create(Node.AsNop));
end;
// Lists
function TAstVisualizer.VisitTuple(const Node: IAstNode): TAstViewNode;
begin
Result := TAstViewNode.Create(Self, TTupleHandler.Create(Node.AsTuple));
@@ -242,8 +235,6 @@ begin
Result := TAstViewNode.Create(Self, TRecordFieldHandler.Create(Node.AsRecordField));
end;
// Control Flow
function TAstVisualizer.VisitBlockExpression(const Node: IAstNode): TAstViewNode;
begin
Result := TAstViewNode.Create(Self, TBlockExpressionNodeHandler.Create(Node.AsBlockExpression));
@@ -264,8 +255,6 @@ begin
Result := TAstViewNode.Create(Self, TRecurNodeHandler.Create(Node.AsRecur));
end;
// Functions
function TAstVisualizer.VisitLambdaExpression(const Node: IAstNode): TAstViewNode;
begin
Result := TAstViewNode.Create(Self, TLambdaExpressionNodeHandler.Create(Node.AsLambdaExpression));
@@ -302,8 +291,6 @@ begin
Result := TAstViewNode.Create(Self, TMacroExpansionNodeHandler.Create(Node.AsMacroExpansion));
end;
// Declarations
function TAstVisualizer.VisitVariableDeclaration(const Node: IAstNode): TAstViewNode;
begin
Result := TAstViewNode.Create(Self, TVariableDeclarationNodeHandler.Create(Node.AsVariableDeclaration));
@@ -319,8 +306,6 @@ begin
Result := TAstViewNode.Create(Self, TMacroDefinitionNodeHandler.Create(Node.AsMacroDefinition));
end;
// Metaprogramming
function TAstVisualizer.VisitQuasiquote(const Node: IAstNode): TAstViewNode;
begin
Result := TAstViewNode.Create(Self, TQuasiquoteNodeHandler.Create(Node.AsQuasiquote));
@@ -336,8 +321,6 @@ begin
Result := TAstViewNode.Create(Self, TUnquoteSplicingNodeHandler.Create(Node.AsUnquoteSplicing));
end;
// Data Access
function TAstVisualizer.VisitIndexer(const Node: IAstNode): TAstViewNode;
begin
Result := TAstViewNode.Create(Self, TIndexerNodeHandler.Create(Node.AsIndexer));
@@ -353,8 +336,6 @@ begin
Result := TAstViewNode.Create(Self, TRecordLiteralNodeHandler.Create(Node.AsRecordLiteral));
end;
// Series
function TAstVisualizer.VisitCreateSeries(const Node: IAstNode): TAstViewNode;
begin
Result := TAstViewNode.Create(Self, TCreateSeriesNodeHandler.Create(Node.AsCreateSeries));
@@ -370,30 +351,9 @@ begin
Result := TAstViewNode.Create(Self, TSeriesLengthNodeHandler.Create(Node.AsSeriesLength));
end;
// Pipes
function TAstVisualizer.VisitPipeInput(const Node: IAstNode): TAstViewNode;
begin
// Needs a dedicated handler for better visualization, fallback to Nop for now?
// Actually, we don't have a specific handler for PipeInputNode in the library yet.
// It's a typed node with children, so we should probably create one or reuse generic.
// For this refactoring step, I'll use Nop to keep it compiling, but this should be improved.
Result := TAstViewNode.Create(Self, TNopNodeHandler.Create(Node.AsNop));
end;
function TAstVisualizer.VisitPipeSelectorList(const Node: IAstNode): TAstViewNode;
begin
Result := TAstViewNode.Create(Self, TPipeSelectorListHandler.Create(Node.AsPipeSelectorList));
end;
function TAstVisualizer.VisitPipeInputList(const Node: IAstNode): TAstViewNode;
begin
Result := TAstViewNode.Create(Self, TPipeInputListHandler.Create(Node.AsPipeInputList));
end;
function TAstVisualizer.VisitPipe(const Node: IAstNode): TAstViewNode;
begin
Result := TAstViewNode.Create(Self, TNopNodeHandler.Create(Node.AsNop));
Result := TAstViewNode.Create(Self, TPipeNodeHandler.Create(Node.AsPipe));
end;
end.