Scripting refinement
This commit is contained in:
+19
-11
@@ -112,6 +112,7 @@ type
|
||||
function ExecuteAst(const ANode: IAstNode; const AParentScope: IExecutionScope): TDataValue;
|
||||
procedure UpdateScript;
|
||||
procedure ShowVizualization(X, Y: Single);
|
||||
procedure PrintScript(const Node: IAstNode);
|
||||
public
|
||||
{ Public declarations }
|
||||
end;
|
||||
@@ -631,6 +632,7 @@ begin
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
FLastAst := setupAst;
|
||||
|
||||
// 1. Bind and execute the setup script.
|
||||
@@ -963,6 +965,21 @@ begin
|
||||
UpdateScript;
|
||||
end;
|
||||
|
||||
procedure TForm1.PrintScript(const Node: IAstNode);
|
||||
begin
|
||||
try
|
||||
FScriptUpdate := true;
|
||||
try
|
||||
ScriptMemo.Lines.Text := ScriptMemo.Lines.Text + #10#13 + TAstScript.Print(Node);
|
||||
finally
|
||||
FScriptUpdate := false;
|
||||
end;
|
||||
except
|
||||
on E: Exception do
|
||||
ScriptMemo.Lines.Add(E.Message);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.ScriptMemoChange(Sender: TObject);
|
||||
begin
|
||||
if FScriptUpdate then
|
||||
@@ -1006,17 +1023,8 @@ end;
|
||||
|
||||
procedure TForm1.UpdateScript;
|
||||
begin
|
||||
try
|
||||
FScriptUpdate := true;
|
||||
try
|
||||
ScriptMemo.Lines.Text := TAstScript.Print(FLastAst);
|
||||
finally
|
||||
FScriptUpdate := false;
|
||||
end;
|
||||
except
|
||||
on E: Exception do
|
||||
ScriptMemo.Lines.Add(E.Message);
|
||||
end;
|
||||
Memo1.Lines.Clear;
|
||||
PrintScript(FLastAst);
|
||||
|
||||
FWorkspace.DeleteChildren;
|
||||
ShowVizualization(14, 14);
|
||||
|
||||
Reference in New Issue
Block a user