Refactoring
This commit is contained in:
@@ -210,7 +210,6 @@ begin
|
||||
FWorkspace.Repaint;
|
||||
|
||||
FGScope := TAst.CreateScope(nil);
|
||||
RegisterNativeFunctions(FGScope);
|
||||
end;
|
||||
|
||||
function TForm1.CompileAst(const ANode: IAstNode; const AParentScope: IExecutionScope; out ADescriptor: IScopeDescriptor): IAstNode;
|
||||
|
||||
@@ -1 +1 @@
|
||||
T:\Myc\IntfExtract\Win64\Debug\ExtractPascalInterfaces.exe -c -dirs T:\Myc\dirs.txt -fc T:\Myc\Src\Ast\Myc.Ast.*.pas
|
||||
T:\Myc\IntfExtract\Win64\Debug\ExtractPascalInterfaces.exe -c -dirs T:\Myc\dirs.txt -fc T:\Myc\Src\Ast\Myc.Ast*
|
||||
@@ -62,20 +62,16 @@ type
|
||||
function Execute(const RootNode: IAstNode): TDataValue;
|
||||
end;
|
||||
|
||||
// Registers native Delphi functions into a scope.
|
||||
procedure RegisterNativeFunctions(const AScope: IExecutionScope);
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
System.TypInfo,
|
||||
System.Generics.Defaults,
|
||||
Myc.Ast, // Added
|
||||
Myc.Ast,
|
||||
Myc.Data.Keyword,
|
||||
Myc.Data.Decimal,
|
||||
Myc.Data.Series,
|
||||
Myc.Data.Scalar.JSON;
|
||||
// Myc.Ast.Binding.Nodes; // Removed
|
||||
|
||||
// Helper type for TCO via trampolining.
|
||||
type
|
||||
@@ -93,34 +89,6 @@ begin
|
||||
Recur := ARecur;
|
||||
end;
|
||||
|
||||
// --- Native Functions Implementation ---
|
||||
|
||||
function NativeCreateRecordSeries(const Args: TArray<TDataValue>): TDataValue;
|
||||
var
|
||||
jsonDef: string;
|
||||
recordDef: IScalarRecordDefinition;
|
||||
series: IRecordSeries;
|
||||
begin
|
||||
if (Length(Args) <> 1) or (Args[0].Kind <> vkText) then
|
||||
raise EArgumentException.Create('CreateRecordSeries requires one string argument.');
|
||||
|
||||
jsonDef := Args[0].AsText;
|
||||
recordDef := TRttiAstHelper.JsonToRecordDefinition(jsonDef);
|
||||
|
||||
if Length(recordDef.Fields) = 0 then
|
||||
raise EArgumentException.Create('Failed to parse record definition from JSON.');
|
||||
|
||||
series := TScalarRecordSeries.Create(recordDef);
|
||||
Result := TDataValue.FromRecordSeries(series);
|
||||
end;
|
||||
|
||||
// --- Registration Procedure ---
|
||||
|
||||
procedure RegisterNativeFunctions(const AScope: IExecutionScope);
|
||||
begin
|
||||
AScope.Define('CreateRecordSeries', TDataValue(NativeCreateRecordSeries));
|
||||
end;
|
||||
|
||||
{ TDynamicRecord }
|
||||
|
||||
type
|
||||
|
||||
@@ -1090,7 +1090,6 @@ end;
|
||||
procedure TPrettyPrintVisitor.VisitNop(const Node: INopNode);
|
||||
begin
|
||||
// A placeholder node, usually for UI.
|
||||
//TODO Nop soll durch ein spezielles ...-Token repräsentiert werden. Analysiere, ob dies syntaktisch möglich ist. Wenn ja, soll der Parser "inoffiziell" in der Lage sein Nops zu lesen und zu erzeugen.
|
||||
Append('...');
|
||||
end;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user