Adding Pipes
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
//==================================================================================================
|
||||
//== FULL UNIT START: Myc.Ast (from Myc.Ast.pas)
|
||||
//==================================================================================================
|
||||
unit Myc.Ast;
|
||||
|
||||
interface
|
||||
@@ -327,6 +330,27 @@ type
|
||||
const AStaticType: IStaticType = nil
|
||||
): ISeriesLengthNode; overload; static;
|
||||
|
||||
// --- PIPES ---
|
||||
|
||||
class function PipeInput(
|
||||
const AStream: IIdentifierNode;
|
||||
const ASelector: IKeywordNode = nil;
|
||||
const Loc: ISourceLocation = nil
|
||||
): IPipeInputNode; static;
|
||||
|
||||
class function Pipe(
|
||||
const AInputs: TArray<IPipeInputNode>;
|
||||
const ATransformation: ILambdaExpressionNode;
|
||||
const Loc: ISourceLocation = nil
|
||||
): IPipeNode; overload; static;
|
||||
|
||||
class function Pipe(
|
||||
const Identity: IAstIdentity;
|
||||
const AInputs: IPipeInputList;
|
||||
const ATransformation: ILambdaExpressionNode;
|
||||
const AStaticType: IStaticType = nil
|
||||
): IPipeNode; overload; static;
|
||||
|
||||
end;
|
||||
|
||||
implementation
|
||||
@@ -909,4 +933,47 @@ begin
|
||||
);
|
||||
end;
|
||||
|
||||
// --- PIPES ---
|
||||
|
||||
class function TAst.PipeInput(const AStream: IIdentifierNode; const ASelector: IKeywordNode; const Loc: ISourceLocation): IPipeInputNode;
|
||||
begin
|
||||
var id := TIdentities.Structural(Loc);
|
||||
// Erzeugt Node aus Myc.Ast.Nodes
|
||||
Result := TPipeInputNode.Create(AStream, ASelector, id, TTypes.Unknown);
|
||||
end;
|
||||
|
||||
class function TAst.Pipe(
|
||||
const AInputs: TArray<IPipeInputNode>;
|
||||
const ATransformation: ILambdaExpressionNode;
|
||||
const Loc: ISourceLocation
|
||||
): IPipeNode;
|
||||
begin
|
||||
var listId := TIdentities.List('[', ']', ' ', Loc);
|
||||
var inputList := TPipeInputList.Create(AInputs, listId);
|
||||
|
||||
var id := TIdentities.Structural(Loc);
|
||||
// Erzeugt Node aus Myc.Ast.Nodes
|
||||
Result := TPipeNode.Create(inputList, ATransformation, id, TTypes.Unknown);
|
||||
end;
|
||||
|
||||
class function TAst.Pipe(
|
||||
const Identity: IAstIdentity;
|
||||
const AInputs: IPipeInputList;
|
||||
const ATransformation: ILambdaExpressionNode;
|
||||
const AStaticType: IStaticType
|
||||
): IPipeNode;
|
||||
begin
|
||||
Result :=
|
||||
TPipeNode.Create(
|
||||
AInputs,
|
||||
ATransformation,
|
||||
Identity,
|
||||
if AStaticType <> nil then AStaticType
|
||||
else TTypes.Unknown
|
||||
);
|
||||
end;
|
||||
|
||||
end.
|
||||
//==================================================================================================
|
||||
//== FULL UNIT END: Myc.Ast
|
||||
//==================================================================================================
|
||||
|
||||
Reference in New Issue
Block a user