From 0b7a60e338d58762cbd5e9175955041b84f071d5 Mon Sep 17 00:00:00 2001 From: Michael Schimmel Date: Tue, 25 Nov 2025 18:45:47 +0100 Subject: [PATCH] AST Identities --- ASTPlayground/ASTPlayground.delphilsp.json | 2 +- ASTPlayground/ASTPlayground.dpr | 3 +- ASTPlayground/ASTPlayground.dproj | 1 + Src/AST/Myc.Ast.Identities.pas | 395 ++++++++++++++++ Src/AST/Myc.Ast.Nodes.pas | 75 +-- Src/AST/Myc.Ast.pas | 518 +++++++++++++++------ 6 files changed, 804 insertions(+), 190 deletions(-) create mode 100644 Src/AST/Myc.Ast.Identities.pas diff --git a/ASTPlayground/ASTPlayground.delphilsp.json b/ASTPlayground/ASTPlayground.delphilsp.json index 87f4d9f..15625fe 100644 --- a/ASTPlayground/ASTPlayground.delphilsp.json +++ b/ASTPlayground/ASTPlayground.delphilsp.json @@ -1 +1 @@ -{ "settings": { "project": "file:///T%3A/Myc/ASTPlayground/ASTPlayground.dpr", "dllname": "dcc64370.dll", "dccOptions": "-$O- -$W+ --inline:off -$R+ -$Q+ --no-config -Q -TX.exe -AGenerics.Collections=System.Generics.Collections;Generics.Defaults=System.Generics.Defaults;WinTypes=Winapi.Windows;WinProcs=Winapi.Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE -DDEBUG;;FRAMEWORK_FMX -E.\\Win64\\Debug -I\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\lib\\Win64\\debug\\DE\";\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\lib\\Win64\\debug\";\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\lib\\Win64\\release\\DE\";T:\\Myc\\Src\\Data;T:\\Myc\\Src\\AST;T:\\Myc\\Src;\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\lib\\Win64\\release\";C:\\Users\\Brummel\\Documents\\Embarcadero\\Studio\\37.0\\Imports\\Win64;\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\Imports\";C:\\Users\\Public\\Documents\\Embarcadero\\Studio\\37.0\\Dcp\\Win64;\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\include\";S:\\sc_famos_src\\svn_vcl\\Virtual-TreeView\\Source;S:\\sc_famos_src\\svn_vcl\\cpxedits;S:\\sc_famos_src\\svn_vcl\\dzChart;S:\\sc_famos_src\\svn_vcl\\eaeditor;S:\\sc_famos_src\\svn_vcl\\FamosEvents;S:\\sc_famos_src\\svn_vcl\\HTML_Viewer\\source;S:\\sc_famos_src\\svn_vcl\\Myc_ChartEdit;S:\\sc_famos_src\\svn_vcl\\Myc_HemiDrag;S:\\sc_famos_src\\svn_vcl\\Myc_SplitControl;S:\\sc_famos_src\\svn_vcl\\plotter;S:\\sc_famos_src\\svn_vcl\\SimpleIPC;S:\\sc_famos_src\\svn_vcl\\SynEdit-master\\Source;S:\\sc_famos_src\\svn_vcl\\ValEdits;S:\\sc_famos_src\\svn_vcl\\ZipMaster;S:\\sc_famos_src\\svn_common\\Myc_VecMath;\"C:\\Program Files (x86)\\DevExpress VCL\\Library\\RS28\\Win64\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressCore Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressCommon Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressGDI+ Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressLibrary\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\XP Theme Manager\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressLayout Control\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressPageControl\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressEditors Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressDocking Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressBars\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressOfficeCore Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressMemData\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressDataController\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressNavBar\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressSkins Library\\Sources\";S:\\3rdParty\\FastMM5;C:\\Users\\Brummel\\AppData\\Local\\Programs\\TestInsight\\Source;T:\\Myc\\Src;\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\source\\DUnitX\" -LEC:\\Users\\Public\\Documents\\Embarcadero\\Studio\\37.0\\Bpl\\Win64 -LNC:\\Users\\Public\\Documents\\Embarcadero\\Studio\\37.0\\Dcp\\Win64 -NU.\\Win64\\Debug -NSWinapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;System;Xml;Data;Datasnap;Web;Soap; -OT:\\Myc\\Src\\Data;T:\\Myc\\Src\\AST;T:\\Myc\\Src;\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\lib\\Win64\\release\";C:\\Users\\Brummel\\Documents\\Embarcadero\\Studio\\37.0\\Imports\\Win64;\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\Imports\";C:\\Users\\Public\\Documents\\Embarcadero\\Studio\\37.0\\Dcp\\Win64;\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\include\";S:\\sc_famos_src\\svn_vcl\\Virtual-TreeView\\Source;S:\\sc_famos_src\\svn_vcl\\cpxedits;S:\\sc_famos_src\\svn_vcl\\dzChart;S:\\sc_famos_src\\svn_vcl\\eaeditor;S:\\sc_famos_src\\svn_vcl\\FamosEvents;S:\\sc_famos_src\\svn_vcl\\HTML_Viewer\\source;S:\\sc_famos_src\\svn_vcl\\Myc_ChartEdit;S:\\sc_famos_src\\svn_vcl\\Myc_HemiDrag;S:\\sc_famos_src\\svn_vcl\\Myc_SplitControl;S:\\sc_famos_src\\svn_vcl\\plotter;S:\\sc_famos_src\\svn_vcl\\SimpleIPC;S:\\sc_famos_src\\svn_vcl\\SynEdit-master\\Source;S:\\sc_famos_src\\svn_vcl\\ValEdits;S:\\sc_famos_src\\svn_vcl\\ZipMaster;S:\\sc_famos_src\\svn_common\\Myc_VecMath;\"C:\\Program Files (x86)\\DevExpress VCL\\Library\\RS28\\Win64\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressCore Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressCommon Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressGDI+ Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressLibrary\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\XP Theme Manager\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressLayout Control\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressPageControl\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressEditors Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressDocking Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressBars\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressOfficeCore Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressMemData\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressDataController\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressNavBar\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressSkins Library\\Sources\";S:\\3rdParty\\FastMM5;C:\\Users\\Brummel\\AppData\\Local\\Programs\\TestInsight\\Source;T:\\Myc\\Src;\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\source\\DUnitX\" -R\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\lib\\Win64\\release\\DE\";T:\\Myc\\Src\\Data;T:\\Myc\\Src\\AST;T:\\Myc\\Src;\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\lib\\Win64\\release\";C:\\Users\\Brummel\\Documents\\Embarcadero\\Studio\\37.0\\Imports\\Win64;\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\Imports\";C:\\Users\\Public\\Documents\\Embarcadero\\Studio\\37.0\\Dcp\\Win64;\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\include\";S:\\sc_famos_src\\svn_vcl\\Virtual-TreeView\\Source;S:\\sc_famos_src\\svn_vcl\\cpxedits;S:\\sc_famos_src\\svn_vcl\\dzChart;S:\\sc_famos_src\\svn_vcl\\eaeditor;S:\\sc_famos_src\\svn_vcl\\FamosEvents;S:\\sc_famos_src\\svn_vcl\\HTML_Viewer\\source;S:\\sc_famos_src\\svn_vcl\\Myc_ChartEdit;S:\\sc_famos_src\\svn_vcl\\Myc_HemiDrag;S:\\sc_famos_src\\svn_vcl\\Myc_SplitControl;S:\\sc_famos_src\\svn_vcl\\plotter;S:\\sc_famos_src\\svn_vcl\\SimpleIPC;S:\\sc_famos_src\\svn_vcl\\SynEdit-master\\Source;S:\\sc_famos_src\\svn_vcl\\ValEdits;S:\\sc_famos_src\\svn_vcl\\ZipMaster;S:\\sc_famos_src\\svn_common\\Myc_VecMath;\"C:\\Program Files (x86)\\DevExpress VCL\\Library\\RS28\\Win64\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressCore Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressCommon Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressGDI+ Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressLibrary\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\XP Theme Manager\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressLayout Control\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressPageControl\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressEditors Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressDocking Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressBars\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressOfficeCore Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressMemData\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressDataController\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressNavBar\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressSkins Library\\Sources\";S:\\3rdParty\\FastMM5;C:\\Users\\Brummel\\AppData\\Local\\Programs\\TestInsight\\Source;T:\\Myc\\Src;\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\source\\DUnitX\" -U\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\lib\\Win64\\debug\\DE\";\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\lib\\Win64\\debug\";\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\lib\\Win64\\release\\DE\";T:\\Myc\\Src\\Data;T:\\Myc\\Src\\AST;T:\\Myc\\Src;\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\lib\\Win64\\release\";C:\\Users\\Brummel\\Documents\\Embarcadero\\Studio\\37.0\\Imports\\Win64;\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\Imports\";C:\\Users\\Public\\Documents\\Embarcadero\\Studio\\37.0\\Dcp\\Win64;\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\include\";S:\\sc_famos_src\\svn_vcl\\Virtual-TreeView\\Source;S:\\sc_famos_src\\svn_vcl\\cpxedits;S:\\sc_famos_src\\svn_vcl\\dzChart;S:\\sc_famos_src\\svn_vcl\\eaeditor;S:\\sc_famos_src\\svn_vcl\\FamosEvents;S:\\sc_famos_src\\svn_vcl\\HTML_Viewer\\source;S:\\sc_famos_src\\svn_vcl\\Myc_ChartEdit;S:\\sc_famos_src\\svn_vcl\\Myc_HemiDrag;S:\\sc_famos_src\\svn_vcl\\Myc_SplitControl;S:\\sc_famos_src\\svn_vcl\\plotter;S:\\sc_famos_src\\svn_vcl\\SimpleIPC;S:\\sc_famos_src\\svn_vcl\\SynEdit-master\\Source;S:\\sc_famos_src\\svn_vcl\\ValEdits;S:\\sc_famos_src\\svn_vcl\\ZipMaster;S:\\sc_famos_src\\svn_common\\Myc_VecMath;\"C:\\Program Files (x86)\\DevExpress VCL\\Library\\RS28\\Win64\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressCore Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressCommon Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressGDI+ Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressLibrary\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\XP Theme Manager\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressLayout Control\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressPageControl\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressEditors Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressDocking Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressBars\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressOfficeCore Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressMemData\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressDataController\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressNavBar\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressSkins Library\\Sources\";S:\\3rdParty\\FastMM5;C:\\Users\\Brummel\\AppData\\Local\\Programs\\TestInsight\\Source;T:\\Myc\\Src;\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\source\\DUnitX\" -V -VN -VR -NBC:\\Users\\Public\\Documents\\Embarcadero\\Studio\\37.0\\Dcp\\Win64 -NHC:\\Users\\Public\\Documents\\Embarcadero\\Studio\\37.0\\hpp\\Win64 -NO.\\Win64\\Debug -LU" , "projectFiles":[ { "name": "MainForm", "file": "file:///T%3A/Myc/ASTPlayground/MainForm.pas" }, { "name": "Myc.Ast.Nodes", "file": "file:///T%3A/Myc/Src/AST/Myc.Ast.Nodes.pas" }, { "name": "Myc.Ast.Scope", "file": "file:///T%3A/Myc/Src/AST/Myc.Ast.Scope.pas" }, { "name": "Myc.Data.Value", "file": "file:///T%3A/Myc/ASTPlayground/Myc.Data.Value.pas" }, { "name": "Myc.Ast.Visitor", "file": "file:///T%3A/Myc/Src/AST/Myc.Ast.Visitor.pas" }, { "name": "Myc.Ast.RTL", "file": "file:///T%3A/Myc/Src/AST/Myc.Ast.RTL.pas" }, { "name": "Myc.Ast.Dumper", "file": "file:///T%3A/Myc/Src/AST/Myc.Ast.Dumper.pas" }, { "name": "Myc.Ast.RTL.Core", "file": "file:///T%3A/Myc/Src/AST/Myc.Ast.RTL.Core.pas" }, { "name": "Myc.Fmx.AstEditor.Node", "file": "file:///T%3A/Myc/ASTPlayground/Myc.Fmx.AstEditor.Node.pas" }, { "name": "Myc.Fmx.AstEditor.Workspace", "file": "file:///T%3A/Myc/ASTPlayground/Myc.Fmx.AstEditor.Workspace.pas" }, { "name": "Myc.Fmx.AstEditor.Text", "file": "file:///T%3A/Myc/ASTPlayground/Myc.Fmx.AstEditor.Text.pas" }, { "name": "Myc.Utils", "file": "file:///T%3A/Myc/Src/Myc.Utils.pas" }, { "name": "Myc.Ast.Script", "file": "file:///T%3A/Myc/Src/AST/Myc.Ast.Script.pas" }, { "name": "Myc.Ast.Types", "file": "file:///T%3A/Myc/Src/AST/Myc.Ast.Types.pas" }, { "name": "Myc.Data.Keyword", "file": "file:///T%3A/Myc/Src/Data/Myc.Data.Keyword.pas" }, { "name": "Myc.Ast.Compiler.TCO", "file": "file:///T%3A/Myc/Src/AST/Myc.Ast.Compiler.TCO.pas" }, { "name": "Myc.Ast.Compiler.Binder", "file": "file:///T%3A/Myc/Src/AST/Myc.Ast.Compiler.Binder.pas" }, { "name": "Myc.Ast.Compiler.Lowering", "file": "file:///T%3A/Myc/Src/AST/Myc.Ast.Compiler.Lowering.pas" }, { "name": "Myc.Ast.Compiler.TypeChecker", "file": "file:///T%3A/Myc/Src/AST/Myc.Ast.Compiler.TypeChecker.pas" }, { "name": "Myc.Ast.Compiler.Macros", "file": "file:///T%3A/Myc/Src/AST/Myc.Ast.Compiler.Macros.pas" }, { "name": "Myc.Ast.Compiler.Specializer", "file": "file:///T%3A/Myc/Src/AST/Myc.Ast.Compiler.Specializer.pas" }, { "name": "Myc.Ast.Environment", "file": "file:///T%3A/Myc/Src/AST/Myc.Ast.Environment.pas" }, { "name": "Myc.Ast.Debugger", "file": "file:///T%3A/Myc/Src/AST/Myc.Ast.Debugger.pas" }, { "name": "Myc.Ast.Analysis.Purity", "file": "file:///T%3A/Myc/Src/AST/Myc.Ast.Analysis.Purity.pas" } ] , "includeDCUsInUsesCompletion": true, "enableKeyWordCompletion": true, "browsingPaths": [ "file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/OCX/Servers","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/SOURCE/VCL","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/rtl/common","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/SOURCE/RTL/SYS","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/rtl/win","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/rtl/win/winrt","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/ToolsAPI","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/SOURCE/IBX","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/Internet","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/SOURCE/PROPERTY%20EDITORS","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/soap","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/SOURCE/XML","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/Indy10/Core","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/Indy10/System","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/Indy10/Protocols","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/fmx","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/databinding/components","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/databinding/engine","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/databinding/graph","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/data","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/data/ado","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/data/cloud","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/data/datasnap","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/data/dbx","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/data/dsnap","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/data/vclctrls","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/data/datasnap/connectors","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/data/datasnap/proxygen","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/DataExplorer","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/DUnit/Contrib/DUnitWizard/Source/Common","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/DUnit/Contrib/DUnitWizard/Source/Common/dunit","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/DUnit/Contrib/DUnitWizard/Source/DelphiExperts/Common","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/DUnit/Contrib/DUnitWizard/Source/DelphiExperts/DUnitProject","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/DUnit/Contrib/DUnitWizard/Source/DelphiExperts/DUnitProject/dunit","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/DUnit/src","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/DUnit/tests","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/Experts","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/indy/abstraction","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/indy/implementation","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/indyimpl","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/Property%20Editors/Indy10","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/soap/wsdlimporter","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/Visualizers","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/DUnit/Contrib/XMLReporting","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/DUnit/Contrib/XPGen","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/data/rest","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/data/firedac","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/tethering","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/DUnitX","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/data/ems","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/rtl/net","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/FlatBox2D","file:///C%3A/Users/Public/Documents/Embarcadero/Studio/37.0/Dcp/%25PLATFORM%25","file:///%25TP%25/runtime/vcl","file:///S%3A/sc_famos_src/svn_vcl/cpxedits","file:///S%3A/sc_famos_src/svn_vcl/dzChart","file:///S%3A/sc_famos_src/svn_vcl/eaeditor","file:///S%3A/sc_famos_src/svn_vcl/FamosEvents","file:///S%3A/sc_famos_src/svn_vcl/HTML_Viewer/source","file:///S%3A/sc_famos_src/svn_vcl/Myc_ChartEdit","file:///S%3A/sc_famos_src/svn_vcl/Myc_HemiDrag","file:///S%3A/sc_famos_src/svn_vcl/Myc_SplitControl","file:///S%3A/sc_famos_src/svn_vcl/NiceChart","file:///S%3A/sc_famos_src/svn_vcl/plotter","file:///S%3A/sc_famos_src/svn_vcl/SimpleIPC","file:///S%3A/sc_famos_src/svn_vcl/SynEdit-master/Source","file:///S%3A/sc_famos_src/svn_vcl/ValEdits","file:///S%3A/sc_famos_src/svn_vcl/ZipMaster","file:///S%3A/sc_famos_src/svn_vcl/ZipMaster/zlib","file:///S%3A/sc_famos_src/svn_vcl/ZipMaster/zlib/win32","file:///S%3A/sc_famos_src/svn_vcl/Virtual-TreeView/Source","file:///S%3A/sc_famos_src/svn_common/caHelpSys","file:///S%3A/sc_famos_src/svn_common/Misc","file:///S%3A/sc_famos_src/svn_common/Myc_VecMath","file:///S%3A/sc_famos_src/svn_common/PascalScript/source","file:///S%3A/sc_famos_src/svn_common/TreeBase","file:///S%3A/sc_famos_src/svn_common/TreeBase/Medien","file:///S%3A/3rdParty/spring4d/Source","file:///S%3A/3rdParty/spring4d/Source/Base","file:///S%3A/3rdParty/spring4d/Source/Base/Collections","file:///S%3A/3rdParty/spring4d/Source/Base/Logging","file:///S%3A/3rdParty/spring4d/Source/Base/Patches","file:///S%3A/3rdParty/spring4d/Source/Core/Container","file:///S%3A/3rdParty/spring4d/Source/Core/Interception","file:///S%3A/3rdParty/spring4d/Source/Core/Logging","file:///S%3A/3rdParty/spring4d/Source/Core/Mocking","file:///S%3A/3rdParty/spring4d/Source/Core/Services","file:///S%3A/3rdParty/spring4d/Source/Extensions/Cryptography","file:///S%3A/3rdParty/spring4d/Source/Extensions/Utils","file:///C%3A/Program%20Files%20%28x86%29/DevExpress%20VCL/ExpressCore%20Library/Sources","file:///C%3A/Program%20Files%20%28x86%29/DevExpress%20VCL/ExpressCommon%20Library/Sources","file:///C%3A/Program%20Files%20%28x86%29/DevExpress%20VCL/ExpressGDI%2B%20Library/Sources","file:///C%3A/Program%20Files%20%28x86%29/DevExpress%20VCL/ExpressLibrary/Sources","file:///C%3A/Program%20Files%20%28x86%29/DevExpress%20VCL/XP%20Theme%20Manager/Sources","file:///C%3A/Program%20Files%20%28x86%29/DevExpress%20VCL/ExpressLayout%20Control/Sources","file:///C%3A/Program%20Files%20%28x86%29/DevExpress%20VCL/ExpressPageControl/Sources","file:///C%3A/Program%20Files%20%28x86%29/DevExpress%20VCL/ExpressEditors%20Library/Sources","file:///C%3A/Program%20Files%20%28x86%29/DevExpress%20VCL/ExpressDocking%20Library/Sources","file:///C%3A/Program%20Files%20%28x86%29/DevExpress%20VCL/ExpressBars/Sources","file:///C%3A/Program%20Files%20%28x86%29/DevExpress%20VCL/ExpressOfficeCore%20Library/Sources","file:///C%3A/Program%20Files%20%28x86%29/DevExpress%20VCL/ExpressMemData/Sources","file:///C%3A/Program%20Files%20%28x86%29/DevExpress%20VCL/ExpressDataController/Sources","file:///C%3A/Program%20Files%20%28x86%29/DevExpress%20VCL/ExpressNavBar/Sources","file:///C%3A/Program%20Files%20%28x86%29/DevExpress%20VCL/ExpressSkins%20Library/Sources","file:///T%3A/Myc/Src","file:///T%3A/Myc/Src/Data","file:///T%3A/Myc/Src/AST" ] , "CommonAppData": "file:///C%3A/Users/Brummel/AppData/Roaming/Embarcadero/BDS/37.0/" , "Templates": "file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/ObjRepos/" } } \ No newline at end of file +{ "settings": { "project": "file:///T%3A/Myc/ASTPlayground/ASTPlayground.dpr", "dllname": "dcc64370.dll", "dccOptions": "-$O- -$W+ --inline:off -$R+ -$Q+ --no-config -Q -TX.exe -AGenerics.Collections=System.Generics.Collections;Generics.Defaults=System.Generics.Defaults;WinTypes=Winapi.Windows;WinProcs=Winapi.Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE -DDEBUG;;FRAMEWORK_FMX -E.\\Win64\\Debug -I\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\lib\\Win64\\debug\\DE\";\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\lib\\Win64\\debug\";\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\lib\\Win64\\release\\DE\";T:\\Myc\\Src\\Data;T:\\Myc\\Src\\AST;T:\\Myc\\Src;\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\lib\\Win64\\release\";C:\\Users\\Brummel\\Documents\\Embarcadero\\Studio\\37.0\\Imports\\Win64;\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\Imports\";C:\\Users\\Public\\Documents\\Embarcadero\\Studio\\37.0\\Dcp\\Win64;\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\include\";S:\\sc_famos_src\\svn_vcl\\Virtual-TreeView\\Source;S:\\sc_famos_src\\svn_vcl\\cpxedits;S:\\sc_famos_src\\svn_vcl\\dzChart;S:\\sc_famos_src\\svn_vcl\\eaeditor;S:\\sc_famos_src\\svn_vcl\\FamosEvents;S:\\sc_famos_src\\svn_vcl\\HTML_Viewer\\source;S:\\sc_famos_src\\svn_vcl\\Myc_ChartEdit;S:\\sc_famos_src\\svn_vcl\\Myc_HemiDrag;S:\\sc_famos_src\\svn_vcl\\Myc_SplitControl;S:\\sc_famos_src\\svn_vcl\\plotter;S:\\sc_famos_src\\svn_vcl\\SimpleIPC;S:\\sc_famos_src\\svn_vcl\\SynEdit-master\\Source;S:\\sc_famos_src\\svn_vcl\\ValEdits;S:\\sc_famos_src\\svn_vcl\\ZipMaster;S:\\sc_famos_src\\svn_common\\Myc_VecMath;\"C:\\Program Files (x86)\\DevExpress VCL\\Library\\RS28\\Win64\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressCore Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressCommon Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressGDI+ Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressLibrary\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\XP Theme Manager\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressLayout Control\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressPageControl\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressEditors Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressDocking Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressBars\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressOfficeCore Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressMemData\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressDataController\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressNavBar\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressSkins Library\\Sources\";S:\\3rdParty\\FastMM5;C:\\Users\\Brummel\\AppData\\Local\\Programs\\TestInsight\\Source;T:\\Myc\\Src;\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\source\\DUnitX\" -LEC:\\Users\\Public\\Documents\\Embarcadero\\Studio\\37.0\\Bpl\\Win64 -LNC:\\Users\\Public\\Documents\\Embarcadero\\Studio\\37.0\\Dcp\\Win64 -NU.\\Win64\\Debug -NSWinapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;System;Xml;Data;Datasnap;Web;Soap; -OT:\\Myc\\Src\\Data;T:\\Myc\\Src\\AST;T:\\Myc\\Src;\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\lib\\Win64\\release\";C:\\Users\\Brummel\\Documents\\Embarcadero\\Studio\\37.0\\Imports\\Win64;\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\Imports\";C:\\Users\\Public\\Documents\\Embarcadero\\Studio\\37.0\\Dcp\\Win64;\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\include\";S:\\sc_famos_src\\svn_vcl\\Virtual-TreeView\\Source;S:\\sc_famos_src\\svn_vcl\\cpxedits;S:\\sc_famos_src\\svn_vcl\\dzChart;S:\\sc_famos_src\\svn_vcl\\eaeditor;S:\\sc_famos_src\\svn_vcl\\FamosEvents;S:\\sc_famos_src\\svn_vcl\\HTML_Viewer\\source;S:\\sc_famos_src\\svn_vcl\\Myc_ChartEdit;S:\\sc_famos_src\\svn_vcl\\Myc_HemiDrag;S:\\sc_famos_src\\svn_vcl\\Myc_SplitControl;S:\\sc_famos_src\\svn_vcl\\plotter;S:\\sc_famos_src\\svn_vcl\\SimpleIPC;S:\\sc_famos_src\\svn_vcl\\SynEdit-master\\Source;S:\\sc_famos_src\\svn_vcl\\ValEdits;S:\\sc_famos_src\\svn_vcl\\ZipMaster;S:\\sc_famos_src\\svn_common\\Myc_VecMath;\"C:\\Program Files (x86)\\DevExpress VCL\\Library\\RS28\\Win64\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressCore Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressCommon Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressGDI+ Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressLibrary\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\XP Theme Manager\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressLayout Control\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressPageControl\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressEditors Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressDocking Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressBars\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressOfficeCore Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressMemData\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressDataController\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressNavBar\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressSkins Library\\Sources\";S:\\3rdParty\\FastMM5;C:\\Users\\Brummel\\AppData\\Local\\Programs\\TestInsight\\Source;T:\\Myc\\Src;\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\source\\DUnitX\" -R\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\lib\\Win64\\release\\DE\";T:\\Myc\\Src\\Data;T:\\Myc\\Src\\AST;T:\\Myc\\Src;\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\lib\\Win64\\release\";C:\\Users\\Brummel\\Documents\\Embarcadero\\Studio\\37.0\\Imports\\Win64;\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\Imports\";C:\\Users\\Public\\Documents\\Embarcadero\\Studio\\37.0\\Dcp\\Win64;\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\include\";S:\\sc_famos_src\\svn_vcl\\Virtual-TreeView\\Source;S:\\sc_famos_src\\svn_vcl\\cpxedits;S:\\sc_famos_src\\svn_vcl\\dzChart;S:\\sc_famos_src\\svn_vcl\\eaeditor;S:\\sc_famos_src\\svn_vcl\\FamosEvents;S:\\sc_famos_src\\svn_vcl\\HTML_Viewer\\source;S:\\sc_famos_src\\svn_vcl\\Myc_ChartEdit;S:\\sc_famos_src\\svn_vcl\\Myc_HemiDrag;S:\\sc_famos_src\\svn_vcl\\Myc_SplitControl;S:\\sc_famos_src\\svn_vcl\\plotter;S:\\sc_famos_src\\svn_vcl\\SimpleIPC;S:\\sc_famos_src\\svn_vcl\\SynEdit-master\\Source;S:\\sc_famos_src\\svn_vcl\\ValEdits;S:\\sc_famos_src\\svn_vcl\\ZipMaster;S:\\sc_famos_src\\svn_common\\Myc_VecMath;\"C:\\Program Files (x86)\\DevExpress VCL\\Library\\RS28\\Win64\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressCore Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressCommon Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressGDI+ Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressLibrary\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\XP Theme Manager\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressLayout Control\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressPageControl\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressEditors Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressDocking Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressBars\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressOfficeCore Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressMemData\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressDataController\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressNavBar\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressSkins Library\\Sources\";S:\\3rdParty\\FastMM5;C:\\Users\\Brummel\\AppData\\Local\\Programs\\TestInsight\\Source;T:\\Myc\\Src;\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\source\\DUnitX\" -U\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\lib\\Win64\\debug\\DE\";\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\lib\\Win64\\debug\";\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\lib\\Win64\\release\\DE\";T:\\Myc\\Src\\Data;T:\\Myc\\Src\\AST;T:\\Myc\\Src;\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\lib\\Win64\\release\";C:\\Users\\Brummel\\Documents\\Embarcadero\\Studio\\37.0\\Imports\\Win64;\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\Imports\";C:\\Users\\Public\\Documents\\Embarcadero\\Studio\\37.0\\Dcp\\Win64;\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\include\";S:\\sc_famos_src\\svn_vcl\\Virtual-TreeView\\Source;S:\\sc_famos_src\\svn_vcl\\cpxedits;S:\\sc_famos_src\\svn_vcl\\dzChart;S:\\sc_famos_src\\svn_vcl\\eaeditor;S:\\sc_famos_src\\svn_vcl\\FamosEvents;S:\\sc_famos_src\\svn_vcl\\HTML_Viewer\\source;S:\\sc_famos_src\\svn_vcl\\Myc_ChartEdit;S:\\sc_famos_src\\svn_vcl\\Myc_HemiDrag;S:\\sc_famos_src\\svn_vcl\\Myc_SplitControl;S:\\sc_famos_src\\svn_vcl\\plotter;S:\\sc_famos_src\\svn_vcl\\SimpleIPC;S:\\sc_famos_src\\svn_vcl\\SynEdit-master\\Source;S:\\sc_famos_src\\svn_vcl\\ValEdits;S:\\sc_famos_src\\svn_vcl\\ZipMaster;S:\\sc_famos_src\\svn_common\\Myc_VecMath;\"C:\\Program Files (x86)\\DevExpress VCL\\Library\\RS28\\Win64\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressCore Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressCommon Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressGDI+ Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressLibrary\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\XP Theme Manager\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressLayout Control\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressPageControl\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressEditors Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressDocking Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressBars\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressOfficeCore Library\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressMemData\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressDataController\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressNavBar\\Sources\";\"C:\\Program Files (x86)\\DevExpress VCL\\ExpressSkins Library\\Sources\";S:\\3rdParty\\FastMM5;C:\\Users\\Brummel\\AppData\\Local\\Programs\\TestInsight\\Source;T:\\Myc\\Src;\"c:\\program files (x86)\\embarcadero\\studio\\37.0\\source\\DUnitX\" -V -VN -VR -NBC:\\Users\\Public\\Documents\\Embarcadero\\Studio\\37.0\\Dcp\\Win64 -NHC:\\Users\\Public\\Documents\\Embarcadero\\Studio\\37.0\\hpp\\Win64 -NO.\\Win64\\Debug -LU" , "projectFiles":[ { "name": "MainForm", "file": "file:///T%3A/Myc/ASTPlayground/MainForm.pas" }, { "name": "Myc.Ast.Nodes", "file": "file:///T%3A/Myc/Src/AST/Myc.Ast.Nodes.pas" }, { "name": "Myc.Ast.Scope", "file": "file:///T%3A/Myc/Src/AST/Myc.Ast.Scope.pas" }, { "name": "Myc.Data.Value", "file": "file:///T%3A/Myc/ASTPlayground/Myc.Data.Value.pas" }, { "name": "Myc.Ast.Visitor", "file": "file:///T%3A/Myc/Src/AST/Myc.Ast.Visitor.pas" }, { "name": "Myc.Ast.RTL", "file": "file:///T%3A/Myc/Src/AST/Myc.Ast.RTL.pas" }, { "name": "Myc.Ast.Dumper", "file": "file:///T%3A/Myc/Src/AST/Myc.Ast.Dumper.pas" }, { "name": "Myc.Ast.RTL.Core", "file": "file:///T%3A/Myc/Src/AST/Myc.Ast.RTL.Core.pas" }, { "name": "Myc.Fmx.AstEditor.Node", "file": "file:///T%3A/Myc/ASTPlayground/Myc.Fmx.AstEditor.Node.pas" }, { "name": "Myc.Fmx.AstEditor.Workspace", "file": "file:///T%3A/Myc/ASTPlayground/Myc.Fmx.AstEditor.Workspace.pas" }, { "name": "Myc.Fmx.AstEditor.Text", "file": "file:///T%3A/Myc/ASTPlayground/Myc.Fmx.AstEditor.Text.pas" }, { "name": "Myc.Utils", "file": "file:///T%3A/Myc/Src/Myc.Utils.pas" }, { "name": "Myc.Ast.Script", "file": "file:///T%3A/Myc/Src/AST/Myc.Ast.Script.pas" }, { "name": "Myc.Ast.Types", "file": "file:///T%3A/Myc/Src/AST/Myc.Ast.Types.pas" }, { "name": "Myc.Data.Keyword", "file": "file:///T%3A/Myc/Src/Data/Myc.Data.Keyword.pas" }, { "name": "Myc.Ast.Compiler.TCO", "file": "file:///T%3A/Myc/Src/AST/Myc.Ast.Compiler.TCO.pas" }, { "name": "Myc.Ast.Compiler.Binder", "file": "file:///T%3A/Myc/Src/AST/Myc.Ast.Compiler.Binder.pas" }, { "name": "Myc.Ast.Compiler.Lowering", "file": "file:///T%3A/Myc/Src/AST/Myc.Ast.Compiler.Lowering.pas" }, { "name": "Myc.Ast.Compiler.TypeChecker", "file": "file:///T%3A/Myc/Src/AST/Myc.Ast.Compiler.TypeChecker.pas" }, { "name": "Myc.Ast.Compiler.Macros", "file": "file:///T%3A/Myc/Src/AST/Myc.Ast.Compiler.Macros.pas" }, { "name": "Myc.Ast.Compiler.Specializer", "file": "file:///T%3A/Myc/Src/AST/Myc.Ast.Compiler.Specializer.pas" }, { "name": "Myc.Ast.Environment", "file": "file:///T%3A/Myc/Src/AST/Myc.Ast.Environment.pas" }, { "name": "Myc.Ast.Debugger", "file": "file:///T%3A/Myc/Src/AST/Myc.Ast.Debugger.pas" }, { "name": "Myc.Ast.Analysis.Purity", "file": "file:///T%3A/Myc/Src/AST/Myc.Ast.Analysis.Purity.pas" }, { "name": "Unit1", "file": "file:///T%3A/Myc/ASTPlayground/Unit1.pas" } ] , "includeDCUsInUsesCompletion": true, "enableKeyWordCompletion": false, "browsingPaths": [ "file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/OCX/Servers","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/SOURCE/VCL","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/rtl/common","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/SOURCE/RTL/SYS","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/rtl/win","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/rtl/win/winrt","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/ToolsAPI","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/SOURCE/IBX","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/Internet","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/SOURCE/PROPERTY%20EDITORS","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/soap","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/SOURCE/XML","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/Indy10/Core","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/Indy10/System","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/Indy10/Protocols","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/fmx","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/databinding/components","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/databinding/engine","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/databinding/graph","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/data","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/data/ado","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/data/cloud","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/data/datasnap","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/data/dbx","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/data/dsnap","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/data/vclctrls","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/data/datasnap/connectors","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/data/datasnap/proxygen","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/DataExplorer","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/DUnit/Contrib/DUnitWizard/Source/Common","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/DUnit/Contrib/DUnitWizard/Source/Common/dunit","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/DUnit/Contrib/DUnitWizard/Source/DelphiExperts/Common","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/DUnit/Contrib/DUnitWizard/Source/DelphiExperts/DUnitProject","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/DUnit/Contrib/DUnitWizard/Source/DelphiExperts/DUnitProject/dunit","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/DUnit/src","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/DUnit/tests","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/Experts","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/indy/abstraction","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/indy/implementation","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/indyimpl","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/Property%20Editors/Indy10","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/soap/wsdlimporter","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/Visualizers","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/DUnit/Contrib/XMLReporting","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/DUnit/Contrib/XPGen","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/data/rest","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/data/firedac","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/tethering","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/DUnitX","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/data/ems","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/rtl/net","file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/source/FlatBox2D","file:///C%3A/Users/Public/Documents/Embarcadero/Studio/37.0/Dcp/%25PLATFORM%25","file:///%25TP%25/runtime/vcl","file:///S%3A/sc_famos_src/svn_vcl/cpxedits","file:///S%3A/sc_famos_src/svn_vcl/dzChart","file:///S%3A/sc_famos_src/svn_vcl/eaeditor","file:///S%3A/sc_famos_src/svn_vcl/FamosEvents","file:///S%3A/sc_famos_src/svn_vcl/HTML_Viewer/source","file:///S%3A/sc_famos_src/svn_vcl/Myc_ChartEdit","file:///S%3A/sc_famos_src/svn_vcl/Myc_HemiDrag","file:///S%3A/sc_famos_src/svn_vcl/Myc_SplitControl","file:///S%3A/sc_famos_src/svn_vcl/NiceChart","file:///S%3A/sc_famos_src/svn_vcl/plotter","file:///S%3A/sc_famos_src/svn_vcl/SimpleIPC","file:///S%3A/sc_famos_src/svn_vcl/SynEdit-master/Source","file:///S%3A/sc_famos_src/svn_vcl/ValEdits","file:///S%3A/sc_famos_src/svn_vcl/ZipMaster","file:///S%3A/sc_famos_src/svn_vcl/ZipMaster/zlib","file:///S%3A/sc_famos_src/svn_vcl/ZipMaster/zlib/win32","file:///S%3A/sc_famos_src/svn_vcl/Virtual-TreeView/Source","file:///S%3A/sc_famos_src/svn_common/caHelpSys","file:///S%3A/sc_famos_src/svn_common/Misc","file:///S%3A/sc_famos_src/svn_common/Myc_VecMath","file:///S%3A/sc_famos_src/svn_common/PascalScript/source","file:///S%3A/sc_famos_src/svn_common/TreeBase","file:///S%3A/sc_famos_src/svn_common/TreeBase/Medien","file:///S%3A/3rdParty/spring4d/Source","file:///S%3A/3rdParty/spring4d/Source/Base","file:///S%3A/3rdParty/spring4d/Source/Base/Collections","file:///S%3A/3rdParty/spring4d/Source/Base/Logging","file:///S%3A/3rdParty/spring4d/Source/Base/Patches","file:///S%3A/3rdParty/spring4d/Source/Core/Container","file:///S%3A/3rdParty/spring4d/Source/Core/Interception","file:///S%3A/3rdParty/spring4d/Source/Core/Logging","file:///S%3A/3rdParty/spring4d/Source/Core/Mocking","file:///S%3A/3rdParty/spring4d/Source/Core/Services","file:///S%3A/3rdParty/spring4d/Source/Extensions/Cryptography","file:///S%3A/3rdParty/spring4d/Source/Extensions/Utils","file:///C%3A/Program%20Files%20%28x86%29/DevExpress%20VCL/ExpressCore%20Library/Sources","file:///C%3A/Program%20Files%20%28x86%29/DevExpress%20VCL/ExpressCommon%20Library/Sources","file:///C%3A/Program%20Files%20%28x86%29/DevExpress%20VCL/ExpressGDI%2B%20Library/Sources","file:///C%3A/Program%20Files%20%28x86%29/DevExpress%20VCL/ExpressLibrary/Sources","file:///C%3A/Program%20Files%20%28x86%29/DevExpress%20VCL/XP%20Theme%20Manager/Sources","file:///C%3A/Program%20Files%20%28x86%29/DevExpress%20VCL/ExpressLayout%20Control/Sources","file:///C%3A/Program%20Files%20%28x86%29/DevExpress%20VCL/ExpressPageControl/Sources","file:///C%3A/Program%20Files%20%28x86%29/DevExpress%20VCL/ExpressEditors%20Library/Sources","file:///C%3A/Program%20Files%20%28x86%29/DevExpress%20VCL/ExpressDocking%20Library/Sources","file:///C%3A/Program%20Files%20%28x86%29/DevExpress%20VCL/ExpressBars/Sources","file:///C%3A/Program%20Files%20%28x86%29/DevExpress%20VCL/ExpressOfficeCore%20Library/Sources","file:///C%3A/Program%20Files%20%28x86%29/DevExpress%20VCL/ExpressMemData/Sources","file:///C%3A/Program%20Files%20%28x86%29/DevExpress%20VCL/ExpressDataController/Sources","file:///C%3A/Program%20Files%20%28x86%29/DevExpress%20VCL/ExpressNavBar/Sources","file:///C%3A/Program%20Files%20%28x86%29/DevExpress%20VCL/ExpressSkins%20Library/Sources","file:///T%3A/Myc/Src","file:///T%3A/Myc/Src/Data","file:///T%3A/Myc/Src/AST" ] , "CommonAppData": "file:///C%3A/Users/Brummel/AppData/Roaming/Embarcadero/BDS/37.0/" , "Templates": "file:///c%3A/program%20files%20%28x86%29/embarcadero/studio/37.0/ObjRepos/" } } \ No newline at end of file diff --git a/ASTPlayground/ASTPlayground.dpr b/ASTPlayground/ASTPlayground.dpr index 0e0365d..afcbf5b 100644 --- a/ASTPlayground/ASTPlayground.dpr +++ b/ASTPlayground/ASTPlayground.dpr @@ -27,7 +27,8 @@ uses Myc.Ast.Compiler.Specializer in '..\Src\AST\Myc.Ast.Compiler.Specializer.pas', Myc.Ast.Environment in '..\Src\AST\Myc.Ast.Environment.pas', Myc.Ast.Debugger in '..\Src\AST\Myc.Ast.Debugger.pas', - Myc.Ast.Analysis.Purity in '..\Src\AST\Myc.Ast.Analysis.Purity.pas'; + Myc.Ast.Analysis.Purity in '..\Src\AST\Myc.Ast.Analysis.Purity.pas', + Myc.Ast.Identities in '..\Src\AST\Myc.Ast.Identities.pas'; {$R *.res} diff --git a/ASTPlayground/ASTPlayground.dproj b/ASTPlayground/ASTPlayground.dproj index 7c8d3b7..261a978 100644 --- a/ASTPlayground/ASTPlayground.dproj +++ b/ASTPlayground/ASTPlayground.dproj @@ -158,6 +158,7 @@ + Base diff --git a/Src/AST/Myc.Ast.Identities.pas b/Src/AST/Myc.Ast.Identities.pas new file mode 100644 index 0000000..147d9aa --- /dev/null +++ b/Src/AST/Myc.Ast.Identities.pas @@ -0,0 +1,395 @@ +unit Myc.Ast.Identities; + +interface + +uses + System.SysUtils, + Myc.Data.Value, + Myc.Data.Keyword; + +type + // Forward declarations + INamedIdentity = interface; + IConstantIdentity = interface; + IKeywordIdentity = interface; + IDefinitionIdentity = interface; + + // Represents a position in the source code. + ISourceLocation = interface + function GetLine: Integer; + function GetCol: Integer; + function ToString: string; + property Line: Integer read GetLine; + property Col: Integer read GetCol; + end; + + // Discriminator enum for identity types. + TAstIdentityKind = ( + ikStructural, // Pure location, no extra data (e.g. If, Block) + ikNamed, // Identifier, MacroDef (Name + Location) + ikConstant, // Literals (Value + Location) + ikKeyword, // Keywords (Keyword + Location) + ikDefinition // Complex definitions (DefString + Location) + ); + + // Base interface for the "Green Tree" nodes. + // Holds the raw syntax data and optional source location. + IAstIdentity = interface + {$region 'private'} + function GetKind: TAstIdentityKind; + function GetLocation: ISourceLocation; + {$endregion} + + function ToString: string; + + // Explicit casting methods (Fail-Fast) + function AsNamed: INamedIdentity; + function AsConstant: IConstantIdentity; + function AsKeyword: IKeywordIdentity; + function AsDefinition: IDefinitionIdentity; + + property Kind: TAstIdentityKind read GetKind; + + // Optional: Returns nil if the node has no source mapping (e.g. generated code) + property Location: ISourceLocation read GetLocation; + end; + + INamedIdentity = interface(IAstIdentity) + {$region 'private'} + function GetName: string; + {$endregion} + property Name: string read GetName; + end; + + IConstantIdentity = interface(IAstIdentity) + {$region 'private'} + function GetValue: TDataValue; + {$endregion} + property Value: TDataValue read GetValue; + end; + + IKeywordIdentity = interface(IAstIdentity) + {$region 'private'} + function GetValue: IKeyword; + {$endregion} + property Value: IKeyword read GetValue; + end; + + IDefinitionIdentity = interface(IAstIdentity) + {$region 'private'} + function GetDefinition: string; + {$endregion} + property Definition: string read GetDefinition; + end; + + // Factory and static access. + TIdentities = record + public + class function Location(ALine, ACol: Integer): ISourceLocation; static; + + class function Structural(const ALoc: ISourceLocation = nil): IAstIdentity; static; + class function Identifier(const AName: string; const ALoc: ISourceLocation = nil): INamedIdentity; static; + class function Constant(const AValue: TDataValue; const ALoc: ISourceLocation = nil): IConstantIdentity; static; + class function Keyword(const AValue: IKeyword; const ALoc: ISourceLocation = nil): IKeywordIdentity; static; + class function Definition(const ADef: string; const ALoc: ISourceLocation = nil): IDefinitionIdentity; static; + end; + +implementation + +type + TSourceLocation = class(TInterfacedObject, ISourceLocation) + private + FLine, FCol: Integer; + function GetLine: Integer; + function GetCol: Integer; + public + constructor Create(ALine, ACol: Integer); + function ToString: string; override; + end; + + // Abstract base implementation providing the casting logic + TAbstractIdentity = class(TInterfacedObject, IAstIdentity) + private + FLocation: ISourceLocation; + function GetKind: TAstIdentityKind; virtual; abstract; + function GetLocation: ISourceLocation; + public + constructor Create(const ALoc: ISourceLocation); + function ToString: string; override; + + function AsNamed: INamedIdentity; virtual; + function AsConstant: IConstantIdentity; virtual; + function AsKeyword: IKeywordIdentity; virtual; + function AsDefinition: IDefinitionIdentity; virtual; + end; + + TStructuralIdentity = class(TAbstractIdentity) + protected + function GetKind: TAstIdentityKind; override; + end; + + TNamedIdentity = class(TAbstractIdentity, INamedIdentity) + private + FName: string; + function GetName: string; + protected + function GetKind: TAstIdentityKind; override; + public + constructor Create(const AName: string; const ALoc: ISourceLocation); + function ToString: string; override; + function AsNamed: INamedIdentity; override; + end; + + TConstantIdentity = class(TAbstractIdentity, IConstantIdentity) + private + FValue: TDataValue; + function GetValue: TDataValue; + protected + function GetKind: TAstIdentityKind; override; + public + constructor Create(const AValue: TDataValue; const ALoc: ISourceLocation); + function ToString: string; override; + function AsConstant: IConstantIdentity; override; + end; + + TKeywordIdentity = class(TAbstractIdentity, IKeywordIdentity) + private + FValue: IKeyword; + function GetValue: IKeyword; + protected + function GetKind: TAstIdentityKind; override; + public + constructor Create(const AValue: IKeyword; const ALoc: ISourceLocation); + function ToString: string; override; + function AsKeyword: IKeywordIdentity; override; + end; + + TDefinitionIdentity = class(TAbstractIdentity, IDefinitionIdentity) + private + FDefinition: string; + function GetDefinition: string; + protected + function GetKind: TAstIdentityKind; override; + public + constructor Create(const ADef: string; const ALoc: ISourceLocation); + function ToString: string; override; + function AsDefinition: IDefinitionIdentity; override; + end; + +{ TSourceLocation } + +constructor TSourceLocation.Create(ALine, ACol: Integer); +begin + inherited Create; + FLine := ALine; + FCol := ACol; +end; + +function TSourceLocation.GetCol: Integer; +begin + Result := FCol; +end; + +function TSourceLocation.GetLine: Integer; +begin + Result := FLine; +end; + +function TSourceLocation.ToString: string; +begin + Result := Format('Line %d, Col %d', [FLine, FCol]); +end; + +{ TAbstractIdentity } + +constructor TAbstractIdentity.Create(const ALoc: ISourceLocation); +begin + inherited Create; + FLocation := ALoc; +end; + +function TAbstractIdentity.GetLocation: ISourceLocation; +begin + Result := FLocation; +end; + +function TAbstractIdentity.ToString: string; +begin + if Assigned(FLocation) then + Result := FLocation.ToString + else + Result := ''; +end; + +function TAbstractIdentity.AsNamed: INamedIdentity; +begin + raise EInvalidCast.Create('Identity is not a Named Identity'); +end; + +function TAbstractIdentity.AsConstant: IConstantIdentity; +begin + raise EInvalidCast.Create('Identity is not a Constant Identity'); +end; + +function TAbstractIdentity.AsKeyword: IKeywordIdentity; +begin + raise EInvalidCast.Create('Identity is not a Keyword Identity'); +end; + +function TAbstractIdentity.AsDefinition: IDefinitionIdentity; +begin + raise EInvalidCast.Create('Identity is not a Definition Identity'); +end; + +{ TStructuralIdentity } + +function TStructuralIdentity.GetKind: TAstIdentityKind; +begin + Result := ikStructural; +end; + +{ TNamedIdentity } + +constructor TNamedIdentity.Create(const AName: string; const ALoc: ISourceLocation); +begin + inherited Create(ALoc); + FName := AName; +end; + +function TNamedIdentity.GetKind: TAstIdentityKind; +begin + Result := ikNamed; +end; + +function TNamedIdentity.GetName: string; +begin + Result := FName; +end; + +function TNamedIdentity.AsNamed: INamedIdentity; +begin + Result := Self; +end; + +function TNamedIdentity.ToString: string; +begin + Result := Format('Name: "%s" (%s)', [FName, inherited ToString]); +end; + +{ TConstantIdentity } + +constructor TConstantIdentity.Create(const AValue: TDataValue; const ALoc: ISourceLocation); +begin + inherited Create(ALoc); + FValue := AValue; +end; + +function TConstantIdentity.GetKind: TAstIdentityKind; +begin + Result := ikConstant; +end; + +function TConstantIdentity.GetValue: TDataValue; +begin + Result := FValue; +end; + +function TConstantIdentity.AsConstant: IConstantIdentity; +begin + Result := Self; +end; + +function TConstantIdentity.ToString: string; +begin + Result := Format('Const: %s (%s)', [FValue.ToString, inherited ToString]); +end; + +{ TKeywordIdentity } + +constructor TKeywordIdentity.Create(const AValue: IKeyword; const ALoc: ISourceLocation); +begin + inherited Create(ALoc); + FValue := AValue; +end; + +function TKeywordIdentity.GetKind: TAstIdentityKind; +begin + Result := ikKeyword; +end; + +function TKeywordIdentity.GetValue: IKeyword; +begin + Result := FValue; +end; + +function TKeywordIdentity.AsKeyword: IKeywordIdentity; +begin + Result := Self; +end; + +function TKeywordIdentity.ToString: string; +begin + Result := Format('Keyword: :%s (%s)', [FValue.Name, inherited ToString]); +end; + +{ TDefinitionIdentity } + +constructor TDefinitionIdentity.Create(const ADef: string; const ALoc: ISourceLocation); +begin + inherited Create(ALoc); + FDefinition := ADef; +end; + +function TDefinitionIdentity.GetKind: TAstIdentityKind; +begin + Result := ikDefinition; +end; + +function TDefinitionIdentity.GetDefinition: string; +begin + Result := FDefinition; +end; + +function TDefinitionIdentity.AsDefinition: IDefinitionIdentity; +begin + Result := Self; +end; + +function TDefinitionIdentity.ToString: string; +begin + Result := Format('Def: "%s" (%s)', [FDefinition, inherited ToString]); +end; + +{ TIdentities } + +class function TIdentities.Location(ALine, ACol: Integer): ISourceLocation; +begin + Result := TSourceLocation.Create(ALine, ACol); +end; + +class function TIdentities.Structural(const ALoc: ISourceLocation): IAstIdentity; +begin + Result := TStructuralIdentity.Create(ALoc); +end; + +class function TIdentities.Identifier(const AName: string; const ALoc: ISourceLocation): INamedIdentity; +begin + Result := TNamedIdentity.Create(AName, ALoc); +end; + +class function TIdentities.Constant(const AValue: TDataValue; const ALoc: ISourceLocation): IConstantIdentity; +begin + Result := TConstantIdentity.Create(AValue, ALoc); +end; + +class function TIdentities.Keyword(const AValue: IKeyword; const ALoc: ISourceLocation): IKeywordIdentity; +begin + Result := TKeywordIdentity.Create(AValue, ALoc); +end; + +class function TIdentities.Definition(const ADef: string; const ALoc: ISourceLocation): IDefinitionIdentity; +begin + Result := TDefinitionIdentity.Create(ADef, ALoc); +end; + +end. diff --git a/Src/AST/Myc.Ast.Nodes.pas b/Src/AST/Myc.Ast.Nodes.pas index b5dac0d..52123ad 100644 --- a/Src/AST/Myc.Ast.Nodes.pas +++ b/Src/AST/Myc.Ast.Nodes.pas @@ -15,6 +15,25 @@ type // --- Forward Declarations --- IAstNode = interface; + // --- Identity & Provenance --- + + /// Represents the immutable identity or provenance of an AST node. + /// This allows tracking where a node came from (Parser, Generator, Macro, etc.) + /// without coupling the AST to specific source formats. + IAstIdentity = interface + ['{5C496755-721D-4793-9526-7E2E63357719}'] + function ToString: string; + end; + + /// Specific identity for nodes originating from source code text. + ISourceLocation = interface(IAstIdentity) + ['{98226687-F323-49B0-8D38-61803B225973}'] + function GetLine: Integer; + function GetCol: Integer; + property Line: Integer read GetLine; + property Col: Integer read GetCol; + end; + // --- Error Handling Infrastructure --- TCompilerErrorLevel = (elHint, elWarning, elError); @@ -28,6 +47,7 @@ type end; ICompilerLog = interface + ['{8E5F2C10-4B3A-49F1-9C2D-7A8B5E6F4D3C}'] procedure Add(ALevel: TCompilerErrorLevel; const AMessage: string; const ANode: IAstNode = nil); procedure AddError(const AMessage: string; const ANode: IAstNode = nil); procedure AddWarning(const AMessage: string; const ANode: IAstNode = nil); @@ -54,12 +74,10 @@ type function GetEntries: TArray; end; - // 1. The abstract base class for all Compiler related exceptions. - // Catching this will catch compilation failures AND internal logic errors. + // Base class for all Compiler related exceptions. EAstException = class(Exception); - // 2. The concrete exception thrown at the END of a compilation pass if errors occurred. - // It wraps the accumulated log. + // The concrete exception thrown at the END of a compilation pass if errors occurred. ECompilationFailed = class(EAstException) private FErrors: TArray; @@ -69,10 +87,6 @@ type property Errors: TArray read FErrors; end; - // 3. (Optional) Exception for critical internal bugs (e.g. implementation defects). - // This should ideally never happen in production. - EInternalCompilerError = class(EAstException); - // --- AST Interfaces --- IAstVisitor = interface; @@ -129,7 +143,6 @@ type akNop ); - // Helper for TAstNodeKind providing a string representation TAstNodeKindHelper = record helper for TAstNodeKind public function ToString: string; @@ -137,7 +150,6 @@ type // --- Concrete Type Definitions --- - // A single field in a record literal TRecordFieldLiteral = record Key: IKeywordNode; Value: IAstNode; @@ -174,6 +186,7 @@ type {$region 'private'} function GetKind: TAstNodeKind; function GetIsTyped: Boolean; + function GetIdentity: IAstIdentity; {$endregion} function Accept(const Visitor: IAstVisitor): TDataValue; @@ -205,6 +218,7 @@ type property IsTyped: Boolean read GetIsTyped; property Kind: TAstNodeKind read GetKind; + property Identity: IAstIdentity read GetIdentity; end; IAstTypedNode = interface(IAstNode) @@ -214,7 +228,6 @@ type property StaticType: IStaticType read GetStaticType; end; - // The abstract definition of a callable function body IFunctionDefinition = interface(IAstTypedNode) {$region 'private'} function GetBody: IAstNode; @@ -227,7 +240,6 @@ type end; INopNode = interface(IAstTypedNode) - // A placeholder node for the UI (e.g., drag target). end; IConstantNode = interface(IAstTypedNode) @@ -246,12 +258,10 @@ type property Name: string read GetName; end; - // Represents a keyword literal in the AST (e.g., :foo) IKeywordNode = interface(IAstTypedNode) {$region 'private'} function GetValue: IKeyword; {$endregion} - // The interned keyword object property Value: IKeyword read GetValue; end; @@ -281,27 +291,17 @@ type {$region 'private'} function GetParameters: TArray; function GetBody: IAstNode; - - // The structural layout. Always present after binding. function GetLayout: IScopeLayout; - - // The runtime descriptor. Can be nil during early compilation phases. function GetDescriptor: IScopeDescriptor; - function GetUpvalues: TArray; function GetHasNestedLambdas: Boolean; - // GetIsPure is inherited from IFunctionDefinition {$endregion} - property Parameters: TArray read GetParameters; property Body: IAstNode read GetBody; - property Layout: IScopeLayout read GetLayout; property Descriptor: IScopeDescriptor read GetDescriptor; - property Upvalues: TArray read GetUpvalues; property HasNestedLambdas: Boolean read GetHasNestedLambdas; - // IsPure is inherited end; IFunctionCallNode = interface(IAstTypedNode) @@ -319,18 +319,15 @@ type property IsTargetPure: Boolean read GetIsTargetPure; end; - // A node representing a macro call. IMacroExpansionNode = interface(IAstTypedNode) {$region 'private'} function GetCallNode: IFunctionCallNode; function GetExpandedBody: IAstNode; {$endregion} - // The AST fragment that resulted from the macro expansion. property CallNode: IFunctionCallNode read GetCallNode; property ExpandedBody: IAstNode read GetExpandedBody; end; - // A node representing a tail-recursive call. IRecurNode = interface(IAstTypedNode) {$region 'private'} function GetArguments: TArray; @@ -376,7 +373,6 @@ type property Body: IAstNode read GetBody; end; - // Represents a quasiquoted expression, e.g., `(a b) IQuasiquoteNode = interface(IAstNode) {$region 'private'} function GetExpression: IAstNode; @@ -384,7 +380,6 @@ type property Expression: IAstNode read GetExpression; end; - // Represents an unquoted expression, e.g., ~x IUnquoteNode = interface(IAstNode) {$region 'private'} function GetExpression: IAstNode; @@ -392,7 +387,6 @@ type property Expression: IAstNode read GetExpression; end; - // Represents an unquote-splicing expression, e.g., ~@y IUnquoteSplicingNode = interface(IAstNode) {$region 'private'} function GetExpression: IQuasiquoteNode; @@ -418,7 +412,6 @@ type property Member: IKeywordNode read GetMember; end; - // Represents a record literal, e.g., {:a 1 :b 2} IRecordLiteralNode = interface(IAstTypedNode) {$region 'private'} function GetFields: TArray; @@ -459,7 +452,6 @@ type function Execute(const RootNode: IAstNode): TDataValue; end; - // A factory for creating visitors TEvaluatorFactory = reference to function(const Scope: IExecutionScope): IEvaluatorVisitor; implementation @@ -496,14 +488,29 @@ begin end; function TCompilerError.ToString: string; +var + location: string; + loc: ISourceLocation; begin - // Simplified string representation for quick debugging + // 1. Try to extract location from Node Identity + location := ''; + if Assigned(Node) and Assigned(Node.Identity) then + begin + if Supports(Node.Identity, ISourceLocation, loc) then + location := Format('[Line %d, Col %d] ', [loc.Line, loc.Col]) + else + location := Format('[%s] ', [Node.Identity.ToString]); + end; + + // 2. Prefix with Level case Level of elHint: Result := '[Hint] '; elWarning: Result := '[Warning] '; elError: Result := '[Error] '; end; - Result := Result + Message; + + // 3. Assemble + Result := Result + location + Message; end; { TCompilerLog } diff --git a/Src/AST/Myc.Ast.pas b/Src/AST/Myc.Ast.pas index b169d70..4f7cfcb 100644 --- a/Src/AST/Myc.Ast.pas +++ b/Src/AST/Myc.Ast.pas @@ -32,29 +32,46 @@ type ARegisterLibraries: Boolean = False ): IExecutionScope; static; - // A No-Operation node, used as a placeholder/stub (e.g., for UI drop targets). - class function Nop(const AStaticType: IStaticType = nil): IAstNode; static; + // A No-Operation node, used as a placeholder/stub. + class function Nop(const AStaticType: IStaticType = nil; const Identity: IAstIdentity = nil): IAstNode; static; // --- Factory functions --- - class function Constant(const AValue: TDataValue; const AStaticType: IStaticType = nil): IConstantNode; overload; static; - class function Constant(const AValue: String): IConstantNode; overload; static; - class function Keyword(const AName: string): IKeywordNode; static; - class function Identifier(AName: string; const AStaticType: IStaticType = nil): IIdentifierNode; overload; static; + class function Constant( + const AValue: TDataValue; + const AStaticType: IStaticType = nil; + const Identity: IAstIdentity = nil + ): IConstantNode; overload; static; + + class function Constant(const AValue: String; const Identity: IAstIdentity = nil): IConstantNode; overload; static; + + class function Keyword(const AName: string; const Identity: IAstIdentity = nil): IKeywordNode; static; + + class function Identifier( + AName: string; + const AStaticType: IStaticType = nil; + const Identity: IAstIdentity = nil + ): IIdentifierNode; overload; static; + class function Identifier( AName: string; const Address: TResolvedAddress; - const AStaticType: IStaticType = nil + const AStaticType: IStaticType = nil; + const Identity: IAstIdentity = nil ): IIdentifierNode; overload; static; + class function IfExpr( const ACondition: IAstNode; const AThenBranch, AElseBranch: IAstNode; - const AStaticType: IStaticType = nil + const AStaticType: IStaticType = nil; + const Identity: IAstIdentity = nil ): IIfExpressionNode; static; + class function TernaryExpr( const ACondition: IAstNode; const AThenBranch, AElseBranch: IAstNode; - const AStaticType: IStaticType = nil + const AStaticType: IStaticType = nil; + const Identity: IAstIdentity = nil ): ITernaryExpressionNode; static; class function LambdaExpr( @@ -65,17 +82,23 @@ type const AUpvalues: TArray = nil; const AHasNestedLambdas: Boolean = False; const AIsPure: Boolean = False; - const AStaticType: IStaticType = nil + const AStaticType: IStaticType = nil; + const Identity: IAstIdentity = nil ): ILambdaExpressionNode; static; class function MacroDef( const AName: IIdentifierNode; const AParameters: TArray; - const ABody: IAstNode + const ABody: IAstNode; + const Identity: IAstIdentity = nil ): IMacroDefinitionNode; static; - class function Quasiquote(const AExpression: IAstNode): IQuasiquoteNode; static; - class function Unquote(const AExpression: IAstNode): IUnquoteNode; static; - class function UnquoteSplicing(const AExpression: IQuasiquoteNode): IUnquoteSplicingNode; static; + + class function Quasiquote(const AExpression: IAstNode; const Identity: IAstIdentity = nil): IQuasiquoteNode; static; + class function Unquote(const AExpression: IAstNode; const Identity: IAstIdentity = nil): IUnquoteNode; static; + class function UnquoteSplicing( + const AExpression: IQuasiquoteNode; + const Identity: IAstIdentity = nil + ): IUnquoteSplicingNode; static; class function FunctionCall( const ACallee: IAstNode; @@ -83,45 +106,85 @@ type const AStaticType: IStaticType = nil; const AIsTailCall: Boolean = False; const AStaticTarget: TDataValue.TFunc = nil; - const AIsTargetPure: Boolean = False + const AIsTargetPure: Boolean = False; + const Identity: IAstIdentity = nil ): IFunctionCallNode; static; class function MacroExpansionNode( const AOriginalCallNode: IFunctionCallNode; - const AExpandedBody: IAstNode + const AExpandedBody: IAstNode; + const Identity: IAstIdentity = nil ): IMacroExpansionNode; static; - class function Recur(const AArguments: array of IAstNode; const AStaticType: IStaticType = nil): IRecurNode; static; - class function Block(const AExpressions: array of IAstNode; const AStaticType: IStaticType = nil): IBlockExpressionNode; static; + + class function Recur( + const AArguments: array of IAstNode; + const AStaticType: IStaticType = nil; + const Identity: IAstIdentity = nil + ): IRecurNode; static; + + class function Block( + const AExpressions: array of IAstNode; + const AStaticType: IStaticType = nil; + const Identity: IAstIdentity = nil + ): IBlockExpressionNode; static; class function VarDecl( const AIdentifier: IAstNode; AInitializer: IAstNode = nil; const AStaticType: IStaticType = nil; - const AIsBoxed: Boolean = False + const AIsBoxed: Boolean = False; + const Identity: IAstIdentity = nil ): IVariableDeclarationNode; static; - class function Assign(const ATarget, AValue: IAstNode; const AStaticType: IStaticType = nil): IAssignmentNode; static; - class function AssignResult(const AValue: IAstNode): IAssignmentNode; static; deprecated; - class function Indexer(const ABase: IAstNode; const AIndex: IAstNode; const AStaticType: IStaticType = nil): IIndexerNode; static; + class function Assign( + const ATarget, AValue: IAstNode; + const AStaticType: IStaticType = nil; + const Identity: IAstIdentity = nil + ): IAssignmentNode; static; + + class function AssignResult(const AValue: IAstNode; const Identity: IAstIdentity = nil): IAssignmentNode; static; deprecated; + + class function Indexer( + const ABase: IAstNode; + const AIndex: IAstNode; + const AStaticType: IStaticType = nil; + const Identity: IAstIdentity = nil + ): IIndexerNode; static; + class function MemberAccess( const ABase: IAstNode; const AMember: IKeywordNode; - const AStaticType: IStaticType = nil + const AStaticType: IStaticType = nil; + const Identity: IAstIdentity = nil ): IMemberAccessNode; static; + class function RecordLiteral( const AFields: TArray; const AScalarDefinition: IScalarRecordDefinition = nil; const AGenericDefinition: IGenericRecordDefinition = nil; - const AStaticType: IStaticType = nil + const AStaticType: IStaticType = nil; + const Identity: IAstIdentity = nil ): IRecordLiteralNode; static; - class function CreateSeries(const ADefinition: String; const AStaticType: IStaticType = nil): ICreateSeriesNode; static; + + class function CreateSeries( + const ADefinition: String; + const AStaticType: IStaticType = nil; + const Identity: IAstIdentity = nil + ): ICreateSeriesNode; static; + class function AddSeriesItem( const ASeries: IIdentifierNode; const AValue: IAstNode; const ALookback: IAstNode = nil; - const AStaticType: IStaticType = nil + const AStaticType: IStaticType = nil; + const Identity: IAstIdentity = nil ): IAddSeriesItemNode; static; - class function SeriesLength(const ASeries: IIdentifierNode; const AStaticType: IStaticType = nil): ISeriesLengthNode; static; + + class function SeriesLength( + const ASeries: IIdentifierNode; + const AStaticType: IStaticType = nil; + const Identity: IAstIdentity = nil + ): ISeriesLengthNode; static; end; @@ -135,10 +198,12 @@ type TAstNode = class(TInterfacedObject, IAstNode) private + FIdentity: IAstIdentity; function GetKind: TAstNodeKind; virtual; abstract; function GetIsTyped: Boolean; virtual; + function GetIdentity: IAstIdentity; public - constructor Create; + constructor Create(const AIdentity: IAstIdentity); function Accept(const Visitor: IAstVisitor): TDataValue; virtual; abstract; // --- As... Accessors Implementation --- @@ -170,6 +235,7 @@ type property IsTyped: Boolean read GetIsTyped; property Kind: TAstNodeKind read GetKind; + property Identity: IAstIdentity read GetIdentity; end; TAstTypedNode = class(TAstNode, IAstTypedNode) @@ -178,7 +244,7 @@ type function GetStaticType: IStaticType; function GetIsTyped: Boolean; override; public - constructor Create(const AStaticType: IStaticType); + constructor Create(const AStaticType: IStaticType; const AIdentity: IAstIdentity); function AsTypedNode: IAstTypedNode; override; property StaticType: IStaticType read GetStaticType; end; @@ -211,7 +277,8 @@ type const ADescriptor: IScopeDescriptor; const AUpvalues: TArray; const AHasNestedLambdas: Boolean; - const AIsPure: Boolean + const AIsPure: Boolean; + const AIdentity: IAstIdentity ); destructor Destroy; override; function Accept(const Visitor: IAstVisitor): TDataValue; override; @@ -238,7 +305,8 @@ type const AStaticType: IStaticType; const AIsTailCall: Boolean; const AStaticTarget: TDataValue.TFunc; - const AIsTargetPure: Boolean + const AIsTargetPure: Boolean; + const AIdentity: IAstIdentity ); function Accept(const Visitor: IAstVisitor): TDataValue; override; function AsFunctionCall: IFunctionCallNode; override; @@ -254,7 +322,13 @@ type function GetIsBoxed: Boolean; function GetKind: TAstNodeKind; override; public - constructor Create(const ATarget: IAstNode; AInitializer: IAstNode; const AStaticType: IStaticType; const AIsBoxed: Boolean); + constructor Create( + const ATarget: IAstNode; + AInitializer: IAstNode; + const AStaticType: IStaticType; + const AIsBoxed: Boolean; + const AIdentity: IAstIdentity + ); function Accept(const Visitor: IAstVisitor): TDataValue; override; function AsVariableDeclaration: IVariableDeclarationNode; override; end; @@ -265,7 +339,7 @@ type function GetValue: TDataValue; function GetKind: TAstNodeKind; override; public - constructor Create(const AValue: TDataValue; const AStaticType: IStaticType); + constructor Create(const AValue: TDataValue; const AStaticType: IStaticType; const AIdentity: IAstIdentity); function Accept(const Visitor: IAstVisitor): TDataValue; override; function AsConstant: IConstantNode; override; property Value: TDataValue read GetValue; @@ -279,7 +353,12 @@ type function GetName: string; function GetKind: TAstNodeKind; override; public - constructor Create(const AName: string; const AAddress: TResolvedAddress; const AStaticType: IStaticType); + constructor Create( + const AName: string; + const AAddress: TResolvedAddress; + const AStaticType: IStaticType; + const AIdentity: IAstIdentity + ); function Accept(const Visitor: IAstVisitor): TDataValue; override; function AsIdentifier: IIdentifierNode; override; property Address: TResolvedAddress read GetAddress; @@ -292,7 +371,7 @@ type function GetValue: IKeyword; function GetKind: TAstNodeKind; override; public - constructor Create(const AValue: IKeyword); + constructor Create(const AValue: IKeyword; const AIdentity: IAstIdentity); function Accept(const Visitor: IAstVisitor): TDataValue; override; function AsKeyword: IKeywordNode; override; property Value: IKeyword read FValue; @@ -308,7 +387,12 @@ type function GetBody: IAstNode; function GetKind: TAstNodeKind; override; public - constructor Create(const AName: IIdentifierNode; const AParameters: TArray; const ABody: IAstNode); + constructor Create( + const AName: IIdentifierNode; + const AParameters: TArray; + const ABody: IAstNode; + const AIdentity: IAstIdentity + ); function Accept(const Visitor: IAstVisitor): TDataValue; override; function AsMacroDefinition: IMacroDefinitionNode; override; property Name: IIdentifierNode read GetName; @@ -322,7 +406,7 @@ type function GetExpression: IAstNode; function GetKind: TAstNodeKind; override; public - constructor Create(const AExpression: IAstNode); + constructor Create(const AExpression: IAstNode; const AIdentity: IAstIdentity); function Accept(const Visitor: IAstVisitor): TDataValue; override; function AsQuasiquote: IQuasiquoteNode; override; property Expression: IAstNode read GetExpression; @@ -334,7 +418,7 @@ type function GetExpression: IAstNode; function GetKind: TAstNodeKind; override; public - constructor Create(const AExpression: IAstNode); + constructor Create(const AExpression: IAstNode; const AIdentity: IAstIdentity); function Accept(const Visitor: IAstVisitor): TDataValue; override; function AsUnquote: IUnquoteNode; override; property Expression: IAstNode read GetExpression; @@ -346,7 +430,7 @@ type function GetExpression: IQuasiquoteNode; function GetKind: TAstNodeKind; override; public - constructor Create(const AExpression: IQuasiquoteNode); + constructor Create(const AExpression: IQuasiquoteNode; const AIdentity: IAstIdentity); function Accept(const Visitor: IAstVisitor): TDataValue; override; function AsUnquoteSplicing: IUnquoteSplicingNode; override; property Expression: IQuasiquoteNode read GetExpression; @@ -360,7 +444,7 @@ type function GetExpandedBody: IAstNode; function GetKind: TAstNodeKind; override; public - constructor Create(const ACallNode: IFunctionCallNode; const AExpandedBody: IAstNode); + constructor Create(const ACallNode: IFunctionCallNode; const AExpandedBody: IAstNode; const AIdentity: IAstIdentity); function Accept(const Visitor: IAstVisitor): TDataValue; override; function AsMacroExpansion: IMacroExpansionNode; override; property CallNode: IFunctionCallNode read GetCallNode; @@ -373,7 +457,7 @@ type function GetArguments: TArray; function GetKind: TAstNodeKind; override; public - constructor Create(const AArguments: TArray; const AStaticType: IStaticType); + constructor Create(const AArguments: TArray; const AStaticType: IStaticType; const AIdentity: IAstIdentity); function Accept(const Visitor: IAstVisitor): TDataValue; override; function AsRecur: IRecurNode; override; property Arguments: TArray read FArguments; @@ -385,7 +469,7 @@ type function GetExpressions: TArray; function GetKind: TAstNodeKind; override; public - constructor Create(const AExpressions: array of IAstNode; const AStaticType: IStaticType); + constructor Create(const AExpressions: array of IAstNode; const AStaticType: IStaticType; const AIdentity: IAstIdentity); function Accept(const Visitor: IAstVisitor): TDataValue; override; function AsBlockExpression: IBlockExpressionNode; override; property Expressions: TArray read FExpressions; @@ -401,7 +485,11 @@ type function GetElseBranch: IAstNode; function GetKind: TAstNodeKind; override; public - constructor Create(const ACondition, AThenBranch, AElseBranch: IAstNode; const AStaticType: IStaticType); + constructor Create( + const ACondition, AThenBranch, AElseBranch: IAstNode; + const AStaticType: IStaticType; + const AIdentity: IAstIdentity + ); function Accept(const Visitor: IAstVisitor): TDataValue; override; function AsIfExpression: IIfExpressionNode; override; property Condition: IAstNode read FCondition; @@ -419,7 +507,11 @@ type function GetElseBranch: IAstNode; function GetKind: TAstNodeKind; override; public - constructor Create(const ACondition, AThenBranch, AElseBranch: IAstNode; const AStaticType: IStaticType); + constructor Create( + const ACondition, AThenBranch, AElseBranch: IAstNode; + const AStaticType: IStaticType; + const AIdentity: IAstIdentity + ); function Accept(const Visitor: IAstVisitor): TDataValue; override; function AsTernaryExpression: ITernaryExpressionNode; override; property Condition: IAstNode read FCondition; @@ -435,7 +527,7 @@ type function GetValue: IAstNode; function GetKind: TAstNodeKind; override; public - constructor Create(const ATarget: IAstNode; const AValue: IAstNode; const AStaticType: IStaticType); + constructor Create(const ATarget: IAstNode; const AValue: IAstNode; const AStaticType: IStaticType; const AIdentity: IAstIdentity); function Accept(const Visitor: IAstVisitor): TDataValue; override; function AsAssignment: IAssignmentNode; override; property Target: IAstNode read FTarget; @@ -450,7 +542,7 @@ type function GetIndex: IAstNode; function GetKind: TAstNodeKind; override; public - constructor Create(const ABase: IAstNode; const AIndex: IAstNode; const AStaticType: IStaticType); + constructor Create(const ABase: IAstNode; const AIndex: IAstNode; const AStaticType: IStaticType; const AIdentity: IAstIdentity); function Accept(const Visitor: IAstVisitor): TDataValue; override; function AsIndexer: IIndexerNode; override; property Base: IAstNode read FBase; @@ -465,7 +557,12 @@ type function GetMember: IKeywordNode; function GetKind: TAstNodeKind; override; public - constructor Create(const ABase: IAstNode; const AMember: IKeywordNode; const AStaticType: IStaticType); + constructor Create( + const ABase: IAstNode; + const AMember: IKeywordNode; + const AStaticType: IStaticType; + const AIdentity: IAstIdentity + ); function Accept(const Visitor: IAstVisitor): TDataValue; override; function AsMemberAccess: IMemberAccessNode; override; property Base: IAstNode read FBase; @@ -478,7 +575,7 @@ type function GetDefinition: String; function GetKind: TAstNodeKind; override; public - constructor Create(const ADefinition: String; const AStaticType: IStaticType); + constructor Create(const ADefinition: String; const AStaticType: IStaticType; const AIdentity: IAstIdentity); function Accept(const Visitor: IAstVisitor): TDataValue; override; function AsCreateSeries: ICreateSeriesNode; override; property Definition: String read FDefinition; @@ -498,7 +595,8 @@ type const ASeries: IIdentifierNode; const AValue: IAstNode; const ALookback: IAstNode; - const AStaticType: IStaticType + const AStaticType: IStaticType; + const AIdentity: IAstIdentity ); function Accept(const Visitor: IAstVisitor): TDataValue; override; function AsAddSeriesItem: IAddSeriesItemNode; override; @@ -513,7 +611,7 @@ type function GetSeries: IIdentifierNode; function GetKind: TAstNodeKind; override; public - constructor Create(const ASeries: IIdentifierNode; const AStaticType: IStaticType); + constructor Create(const ASeries: IIdentifierNode; const AStaticType: IStaticType; const AIdentity: IAstIdentity); function Accept(const Visitor: IAstVisitor): TDataValue; override; function AsSeriesLength: ISeriesLengthNode; override; property Series: IIdentifierNode read FSeries; @@ -533,7 +631,8 @@ type const AFields: TArray; const AScalarDefinition: IScalarRecordDefinition; const AGenericDefinition: IGenericRecordDefinition; - const AStaticType: IStaticType + const AStaticType: IStaticType; + const AIdentity: IAstIdentity ); function Accept(const Visitor: IAstVisitor): TDataValue; override; function AsRecordLiteral: IRecordLiteralNode; override; @@ -546,7 +645,7 @@ type private function GetKind: TAstNodeKind; override; public - constructor Create(const AStaticType: IStaticType); + constructor Create(const AStaticType: IStaticType; const AIdentity: IAstIdentity); function Accept(const Visitor: IAstVisitor): TDataValue; override; function AsNop: INopNode; override; end; @@ -571,13 +670,18 @@ begin end; end; -class function TAst.CreateSeries(const ADefinition: String; const AStaticType: IStaticType = nil): ICreateSeriesNode; +class function TAst.CreateSeries( + const ADefinition: String; + const AStaticType: IStaticType = nil; + const Identity: IAstIdentity = nil +): ICreateSeriesNode; begin Result := TCreateSeriesNode.Create( ADefinition, if AStaticType <> nil then AStaticType - else TTypes.Unknown + else TTypes.Unknown, + Identity ); end; @@ -585,7 +689,8 @@ class function TAst.AddSeriesItem( const ASeries: IIdentifierNode; const AValue: IAstNode; const ALookback: IAstNode = nil; - const AStaticType: IStaticType = nil + const AStaticType: IStaticType = nil; + const Identity: IAstIdentity = nil ): IAddSeriesItemNode; begin Result := @@ -594,47 +699,67 @@ begin AValue, ALookback, if AStaticType <> nil then AStaticType - else TTypes.Void + else TTypes.Void, + Identity ); end; -class function TAst.SeriesLength(const ASeries: IIdentifierNode; const AStaticType: IStaticType = nil): ISeriesLengthNode; +class function TAst.SeriesLength( + const ASeries: IIdentifierNode; + const AStaticType: IStaticType = nil; + const Identity: IAstIdentity = nil +): ISeriesLengthNode; begin Result := TSeriesLengthNode.Create( ASeries, if AStaticType <> nil then AStaticType - else TTypes.Ordinal + else TTypes.Ordinal, + Identity ); end; -class function TAst.Assign(const ATarget, AValue: IAstNode; const AStaticType: IStaticType = nil): IAssignmentNode; +class function TAst.Assign( + const ATarget, AValue: IAstNode; + const AStaticType: IStaticType = nil; + const Identity: IAstIdentity = nil +): IAssignmentNode; begin Result := TAssignmentNode.Create( ATarget, AValue, if AStaticType <> nil then AStaticType - else TTypes.Unknown + else TTypes.Unknown, + Identity ); end; -class function TAst.AssignResult(const AValue: IAstNode): IAssignmentNode; +class function TAst.AssignResult(const AValue: IAstNode; const Identity: IAstIdentity = nil): IAssignmentNode; begin - Result := TAssignmentNode.Create(TAst.Identifier('Result'), AValue, TTypes.Unknown); + Result := TAssignmentNode.Create(TAst.Identifier('Result', nil, Identity), AValue, TTypes.Unknown, Identity); end; -class function TAst.Block(const AExpressions: array of IAstNode; const AStaticType: IStaticType = nil): IBlockExpressionNode; +class function TAst.Block( + const AExpressions: array of IAstNode; + const AStaticType: IStaticType = nil; + const Identity: IAstIdentity = nil +): IBlockExpressionNode; begin Result := TBlockExpressionNode.Create( AExpressions, if AStaticType <> nil then AStaticType - else TTypes.Unknown + else TTypes.Unknown, + Identity ); end; -class function TAst.Constant(const AValue: TDataValue; const AStaticType: IStaticType = nil): IConstantNode; +class function TAst.Constant( + const AValue: TDataValue; + const AStaticType: IStaticType = nil; + const Identity: IAstIdentity = nil +): IConstantNode; begin var constType := AStaticType; if constType = nil then @@ -647,12 +772,12 @@ begin constType := TTypes.Unknown; end; end; - Result := TConstantNode.Create(AValue, constType); + Result := TConstantNode.Create(AValue, constType, Identity); end; -class function TAst.Constant(const AValue: String): IConstantNode; +class function TAst.Constant(const AValue: String; const Identity: IAstIdentity = nil): IConstantNode; begin - Result := TConstantNode.Create(AValue, TTypes.Text); + Result := TConstantNode.Create(AValue, TTypes.Text, Identity); end; class constructor TAst.Create; @@ -676,7 +801,8 @@ class function TAst.FunctionCall( const AStaticType: IStaticType = nil; const AIsTailCall: Boolean = False; const AStaticTarget: TDataValue.TFunc = nil; - const AIsTargetPure: Boolean = False + const AIsTargetPure: Boolean = False; + const Identity: IAstIdentity = nil ): IFunctionCallNode; begin Result := @@ -687,36 +813,45 @@ begin else TTypes.Unknown, AIsTailCall, AStaticTarget, - AIsTargetPure + AIsTargetPure, + Identity ); end; -class function TAst.Identifier(AName: string; const AStaticType: IStaticType = nil): IIdentifierNode; +class function TAst.Identifier(AName: string; const AStaticType: IStaticType = nil; const Identity: IAstIdentity = nil): IIdentifierNode; begin Result := TIdentifierNode.Create( AName, Default(TResolvedAddress), if AStaticType <> nil then AStaticType - else TTypes.Unknown + else TTypes.Unknown, + Identity ); end; -class function TAst.Identifier(AName: string; const Address: TResolvedAddress; const AStaticType: IStaticType = nil): IIdentifierNode; +class function TAst.Identifier( + AName: string; + const Address: TResolvedAddress; + const AStaticType: IStaticType = nil; + const Identity: IAstIdentity = nil +): IIdentifierNode; begin Result := TIdentifierNode.Create( AName, Address, if AStaticType <> nil then AStaticType - else TTypes.Unknown + else TTypes.Unknown, + Identity ); end; class function TAst.IfExpr( const ACondition: IAstNode; const AThenBranch, AElseBranch: IAstNode; - const AStaticType: IStaticType = nil + const AStaticType: IStaticType = nil; + const Identity: IAstIdentity = nil ): IIfExpressionNode; begin Result := @@ -725,24 +860,31 @@ begin AThenBranch, AElseBranch, if AStaticType <> nil then AStaticType - else TTypes.Unknown + else TTypes.Unknown, + Identity ); end; -class function TAst.Indexer(const ABase: IAstNode; const AIndex: IAstNode; const AStaticType: IStaticType = nil): IIndexerNode; +class function TAst.Indexer( + const ABase: IAstNode; + const AIndex: IAstNode; + const AStaticType: IStaticType = nil; + const Identity: IAstIdentity = nil +): IIndexerNode; begin Result := TIndexerNode.Create( ABase, AIndex, if AStaticType <> nil then AStaticType - else TTypes.Unknown + else TTypes.Unknown, + Identity ); end; -class function TAst.Keyword(const AName: string): IKeywordNode; +class function TAst.Keyword(const AName: string; const Identity: IAstIdentity = nil): IKeywordNode; begin - Result := TKeywordNode.Create(TKeywordRegistry.Intern(AName)); + Result := TKeywordNode.Create(TKeywordRegistry.Intern(AName), Identity); end; class function TAst.LambdaExpr( @@ -753,7 +895,8 @@ class function TAst.LambdaExpr( const AUpvalues: TArray = nil; const AHasNestedLambdas: Boolean = False; const AIsPure: Boolean = False; - const AStaticType: IStaticType = nil + const AStaticType: IStaticType = nil; + const Identity: IAstIdentity = nil ): ILambdaExpressionNode; begin Result := @@ -766,28 +909,35 @@ begin ADescriptor, AUpvalues, AHasNestedLambdas, - AIsPure + AIsPure, + Identity ); end; class function TAst.MacroDef( const AName: IIdentifierNode; const AParameters: TArray; - const ABody: IAstNode + const ABody: IAstNode; + const Identity: IAstIdentity = nil ): IMacroDefinitionNode; begin - Result := TMacroDefinitionNode.Create(AName, AParameters, ABody); + Result := TMacroDefinitionNode.Create(AName, AParameters, ABody, Identity); end; -class function TAst.MacroExpansionNode(const AOriginalCallNode: IFunctionCallNode; const AExpandedBody: IAstNode): IMacroExpansionNode; +class function TAst.MacroExpansionNode( + const AOriginalCallNode: IFunctionCallNode; + const AExpandedBody: IAstNode; + const Identity: IAstIdentity = nil +): IMacroExpansionNode; begin - Result := TMacroExpansionNode.Create(AOriginalCallNode, AExpandedBody); + Result := TMacroExpansionNode.Create(AOriginalCallNode, AExpandedBody, Identity); end; class function TAst.MemberAccess( const ABase: IAstNode; const AMember: IKeywordNode; - const AStaticType: IStaticType = nil + const AStaticType: IStaticType = nil; + const Identity: IAstIdentity = nil ): IMemberAccessNode; begin Result := @@ -795,21 +945,26 @@ begin ABase, AMember, if AStaticType <> nil then AStaticType - else TTypes.Unknown + else TTypes.Unknown, + Identity ); end; -class function TAst.Nop(const AStaticType: IStaticType = nil): IAstNode; +class function TAst.Nop(const AStaticType: IStaticType = nil; const Identity: IAstIdentity = nil): IAstNode; begin - Result := TNopNode.Create(TTypes.Unknown); + Result := TNopNode.Create(TTypes.Unknown, Identity); end; -class function TAst.Quasiquote(const AExpression: IAstNode): IQuasiquoteNode; +class function TAst.Quasiquote(const AExpression: IAstNode; const Identity: IAstIdentity = nil): IQuasiquoteNode; begin - Result := TQuasiquoteNode.Create(AExpression); + Result := TQuasiquoteNode.Create(AExpression, Identity); end; -class function TAst.Recur(const AArguments: array of IAstNode; const AStaticType: IStaticType = nil): IRecurNode; +class function TAst.Recur( + const AArguments: array of IAstNode; + const AStaticType: IStaticType = nil; + const Identity: IAstIdentity = nil +): IRecurNode; var args: TArray; i: Integer; @@ -821,7 +976,8 @@ begin TRecurNode.Create( args, if AStaticType <> nil then AStaticType - else TTypes.Void + else TTypes.Void, + Identity ); end; @@ -829,7 +985,8 @@ class function TAst.RecordLiteral( const AFields: TArray; const AScalarDefinition: IScalarRecordDefinition = nil; const AGenericDefinition: IGenericRecordDefinition = nil; - const AStaticType: IStaticType = nil + const AStaticType: IStaticType = nil; + const Identity: IAstIdentity = nil ): IRecordLiteralNode; begin Result := @@ -838,14 +995,16 @@ begin AScalarDefinition, AGenericDefinition, if AStaticType <> nil then AStaticType - else TTypes.Unknown + else TTypes.Unknown, + Identity ); end; class function TAst.TernaryExpr( const ACondition: IAstNode; const AThenBranch, AElseBranch: IAstNode; - const AStaticType: IStaticType = nil + const AStaticType: IStaticType = nil; + const Identity: IAstIdentity = nil ): ITernaryExpressionNode; begin Result := @@ -854,25 +1013,27 @@ begin AThenBranch, AElseBranch, if AStaticType <> nil then AStaticType - else TTypes.Unknown + else TTypes.Unknown, + Identity ); end; -class function TAst.Unquote(const AExpression: IAstNode): IUnquoteNode; +class function TAst.Unquote(const AExpression: IAstNode; const Identity: IAstIdentity = nil): IUnquoteNode; begin - Result := TUnquoteNode.Create(AExpression); + Result := TUnquoteNode.Create(AExpression, Identity); end; -class function TAst.UnquoteSplicing(const AExpression: IQuasiquoteNode): IUnquoteSplicingNode; +class function TAst.UnquoteSplicing(const AExpression: IQuasiquoteNode; const Identity: IAstIdentity = nil): IUnquoteSplicingNode; begin - Result := TUnquoteSplicingNode.Create(AExpression); + Result := TUnquoteSplicingNode.Create(AExpression, Identity); end; class function TAst.VarDecl( const AIdentifier: IAstNode; AInitializer: IAstNode = nil; const AStaticType: IStaticType = nil; - const AIsBoxed: Boolean = False + const AIsBoxed: Boolean = False; + const Identity: IAstIdentity = nil ): IVariableDeclarationNode; begin Result := @@ -881,15 +1042,16 @@ begin AInitializer, if AStaticType <> nil then AStaticType else TTypes.Unknown, - AIsBoxed + AIsBoxed, + Identity ); end; { TNopNode } -constructor TNopNode.Create(const AStaticType: IStaticType); +constructor TNopNode.Create(const AStaticType: IStaticType; const AIdentity: IAstIdentity); begin - inherited Create(AStaticType); + inherited Create(AStaticType, AIdentity); end; function TNopNode.Accept(const Visitor: IAstVisitor): TDataValue; @@ -909,9 +1071,15 @@ end; { TAstNode } -constructor TAstNode.Create; +constructor TAstNode.Create(const AIdentity: IAstIdentity); begin inherited Create; + FIdentity := AIdentity; +end; + +function TAstNode.GetIdentity: IAstIdentity; +begin + Result := FIdentity; end; function TAstNode.AsAddSeriesItem: IAddSeriesItemNode; @@ -1065,9 +1233,9 @@ end; { TAstTypedNode } -constructor TAstTypedNode.Create(const AStaticType: IStaticType); +constructor TAstTypedNode.Create(const AStaticType: IStaticType; const AIdentity: IAstIdentity); begin - inherited Create; + inherited Create(AIdentity); FStaticType := AStaticType; Assert(FStaticType <> nil); end; @@ -1089,9 +1257,9 @@ end; { TConstantNode } -constructor TConstantNode.Create(const AValue: TDataValue; const AStaticType: IStaticType); +constructor TConstantNode.Create(const AValue: TDataValue; const AStaticType: IStaticType; const AIdentity: IAstIdentity); begin - inherited Create(AStaticType); + inherited Create(AStaticType, AIdentity); FValue := AValue; end; @@ -1117,9 +1285,14 @@ end; { TIdentifierNode } -constructor TIdentifierNode.Create(const AName: string; const AAddress: TResolvedAddress; const AStaticType: IStaticType); +constructor TIdentifierNode.Create( + const AName: string; + const AAddress: TResolvedAddress; + const AStaticType: IStaticType; + const AIdentity: IAstIdentity +); begin - inherited Create(AStaticType); + inherited Create(AStaticType, AIdentity); FName := AName; FAddress := AAddress; end; @@ -1151,9 +1324,9 @@ end; { TKeywordNode } -constructor TKeywordNode.Create(const AValue: IKeyword); +constructor TKeywordNode.Create(const AValue: IKeyword; const AIdentity: IAstIdentity); begin - inherited Create(TTypes.Keyword); + inherited Create(TTypes.Keyword, AIdentity); FValue := AValue; end; @@ -1179,9 +1352,13 @@ end; { TIfExpressionNode } -constructor TIfExpressionNode.Create(const ACondition, AThenBranch, AElseBranch: IAstNode; const AStaticType: IStaticType); +constructor TIfExpressionNode.Create( + const ACondition, AThenBranch, AElseBranch: IAstNode; + const AStaticType: IStaticType; + const AIdentity: IAstIdentity +); begin - inherited Create(AStaticType); + inherited Create(AStaticType, AIdentity); FCondition := ACondition; FThenBranch := AThenBranch; FElseBranch := AElseBranch; @@ -1219,9 +1396,13 @@ end; { TTernaryExpressionNode } -constructor TTernaryExpressionNode.Create(const ACondition, AThenBranch, AElseBranch: IAstNode; const AStaticType: IStaticType); +constructor TTernaryExpressionNode.Create( + const ACondition, AThenBranch, AElseBranch: IAstNode; + const AStaticType: IStaticType; + const AIdentity: IAstIdentity +); begin - inherited Create(AStaticType); + inherited Create(AStaticType, AIdentity); FCondition := ACondition; FThenBranch := AThenBranch; FElseBranch := AElseBranch; @@ -1267,10 +1448,11 @@ constructor TLambdaExpressionNode.Create( const ADescriptor: IScopeDescriptor; const AUpvalues: TArray; const AHasNestedLambdas: Boolean; - const AIsPure: Boolean + const AIsPure: Boolean; + const AIdentity: IAstIdentity ); begin - inherited Create(AStaticType); + inherited Create(AStaticType, AIdentity); FParameters := AParameters; FBody := ABody; FLayout := ALayout; @@ -1341,9 +1523,14 @@ end; { TMacroDefinitionNode } -constructor TMacroDefinitionNode.Create(const AName: IIdentifierNode; const AParameters: TArray; const ABody: IAstNode); +constructor TMacroDefinitionNode.Create( + const AName: IIdentifierNode; + const AParameters: TArray; + const ABody: IAstNode; + const AIdentity: IAstIdentity +); begin - inherited Create(TTypes.Void); + inherited Create(TTypes.Void, AIdentity); FName := AName; FParameters := AParameters; FBody := ABody; @@ -1381,9 +1568,9 @@ end; { TQuasiquoteNode } -constructor TQuasiquoteNode.Create(const AExpression: IAstNode); +constructor TQuasiquoteNode.Create(const AExpression: IAstNode; const AIdentity: IAstIdentity); begin - inherited Create; + inherited Create(AIdentity); FExpression := AExpression; end; @@ -1409,9 +1596,9 @@ end; { TUnquoteNode } -constructor TUnquoteNode.Create(const AExpression: IAstNode); +constructor TUnquoteNode.Create(const AExpression: IAstNode; const AIdentity: IAstIdentity); begin - inherited Create; + inherited Create(AIdentity); FExpression := AExpression; end; @@ -1437,9 +1624,9 @@ end; { TUnquoteSplicingNode } -constructor TUnquoteSplicingNode.Create(const AExpression: IQuasiquoteNode); +constructor TUnquoteSplicingNode.Create(const AExpression: IQuasiquoteNode; const AIdentity: IAstIdentity); begin - inherited Create; + inherited Create(AIdentity); FExpression := AExpression; end; @@ -1471,10 +1658,11 @@ constructor TFunctionCallNode.Create( const AStaticType: IStaticType; const AIsTailCall: Boolean; const AStaticTarget: TDataValue.TFunc; - const AIsTargetPure: Boolean + const AIsTargetPure: Boolean; + const AIdentity: IAstIdentity ); begin - inherited Create(AStaticType); + inherited Create(AStaticType, AIdentity); FCallee := ACallee; FArguments := AArguments; FIsTailCall := AIsTailCall; @@ -1524,12 +1712,12 @@ end; { TMacroExpansionNode } -constructor TMacroExpansionNode.Create(const ACallNode: IFunctionCallNode; const AExpandedBody: IAstNode); +constructor TMacroExpansionNode.Create(const ACallNode: IFunctionCallNode; const AExpandedBody: IAstNode; const AIdentity: IAstIdentity); begin if AExpandedBody.IsTyped then - inherited Create(AExpandedBody.AsTypedNode.StaticType) + inherited Create(AExpandedBody.AsTypedNode.StaticType, AIdentity) else - inherited Create(TTypes.Unknown); + inherited Create(TTypes.Unknown, AIdentity); FExpandedBody := AExpandedBody; FCallNode := ACallNode; @@ -1562,9 +1750,9 @@ end; { TRecurNode } -constructor TRecurNode.Create(const AArguments: TArray; const AStaticType: IStaticType); +constructor TRecurNode.Create(const AArguments: TArray; const AStaticType: IStaticType; const AIdentity: IAstIdentity); begin - inherited Create(AStaticType); + inherited Create(AStaticType, AIdentity); FArguments := AArguments; end; @@ -1590,11 +1778,15 @@ end; { TBlockExpressionNode } -constructor TBlockExpressionNode.Create(const AExpressions: array of IAstNode; const AStaticType: IStaticType); +constructor TBlockExpressionNode.Create( + const AExpressions: array of IAstNode; + const AStaticType: IStaticType; + const AIdentity: IAstIdentity +); var i: Integer; begin - inherited Create(AStaticType); + inherited Create(AStaticType, AIdentity); SetLength(FExpressions, Length(AExpressions)); for i := 0 to High(AExpressions) do FExpressions[i] := AExpressions[i]; @@ -1626,10 +1818,11 @@ constructor TVariableDeclarationNode.Create( const ATarget: IAstNode; AInitializer: IAstNode; const AStaticType: IStaticType; - const AIsBoxed: Boolean + const AIsBoxed: Boolean; + const AIdentity: IAstIdentity ); begin - inherited Create(AStaticType); + inherited Create(AStaticType, AIdentity); FTarget := ATarget; FInitializer := AInitializer; FIsBoxed := AIsBoxed; @@ -1667,9 +1860,14 @@ end; { TAssignmentNode } -constructor TAssignmentNode.Create(const ATarget: IAstNode; const AValue: IAstNode; const AStaticType: IStaticType); +constructor TAssignmentNode.Create( + const ATarget: IAstNode; + const AValue: IAstNode; + const AStaticType: IStaticType; + const AIdentity: IAstIdentity +); begin - inherited Create(AStaticType); + inherited Create(AStaticType, AIdentity); FTarget := ATarget; FValue := AValue; end; @@ -1701,9 +1899,14 @@ end; { TIndexerNode } -constructor TIndexerNode.Create(const ABase: IAstNode; const AIndex: IAstNode; const AStaticType: IStaticType); +constructor TIndexerNode.Create( + const ABase: IAstNode; + const AIndex: IAstNode; + const AStaticType: IStaticType; + const AIdentity: IAstIdentity +); begin - inherited Create(AStaticType); + inherited Create(AStaticType, AIdentity); FBase := ABase; FIndex := AIndex; end; @@ -1735,9 +1938,14 @@ end; { TMemberAccessNode } -constructor TMemberAccessNode.Create(const ABase: IAstNode; const AMember: IKeywordNode; const AStaticType: IStaticType); +constructor TMemberAccessNode.Create( + const ABase: IAstNode; + const AMember: IKeywordNode; + const AStaticType: IStaticType; + const AIdentity: IAstIdentity +); begin - inherited Create(AStaticType); + inherited Create(AStaticType, AIdentity); FBase := ABase; FMember := AMember; end; @@ -1773,10 +1981,11 @@ constructor TRecordLiteralNode.Create( const AFields: TArray; const AScalarDefinition: IScalarRecordDefinition; const AGenericDefinition: IGenericRecordDefinition; - const AStaticType: IStaticType + const AStaticType: IStaticType; + const AIdentity: IAstIdentity ); begin - inherited Create(AStaticType); + inherited Create(AStaticType, AIdentity); FFields := AFields; FGenericDefinition := AGenericDefinition; FScalarDefinition := AScalarDefinition; @@ -1814,9 +2023,9 @@ end; { TCreateSeriesNode } -constructor TCreateSeriesNode.Create(const ADefinition: String; const AStaticType: IStaticType); +constructor TCreateSeriesNode.Create(const ADefinition: String; const AStaticType: IStaticType; const AIdentity: IAstIdentity); begin - inherited Create(AStaticType); + inherited Create(AStaticType, AIdentity); FDefinition := ADefinition; end; @@ -1846,10 +2055,11 @@ constructor TAddSeriesItemNode.Create( const ASeries: IIdentifierNode; const AValue: IAstNode; const ALookback: IAstNode; - const AStaticType: IStaticType + const AStaticType: IStaticType; + const AIdentity: IAstIdentity ); begin - inherited Create(AStaticType); + inherited Create(AStaticType, AIdentity); FSeries := ASeries; FValue := AValue; FLookback := ALookback; @@ -1887,9 +2097,9 @@ end; { TSeriesLengthNode } -constructor TSeriesLengthNode.Create(const ASeries: IIdentifierNode; const AStaticType: IStaticType); +constructor TSeriesLengthNode.Create(const ASeries: IIdentifierNode; const AStaticType: IStaticType; const AIdentity: IAstIdentity); begin - inherited Create(AStaticType); + inherited Create(AStaticType, AIdentity); FSeries := ASeries; end;