Changeset 92 for branches/dcomp/CmdLine/Compiler
- Timestamp:
- Nov 4, 2016, 4:25:29 PM (8 years ago)
- Location:
- branches/dcomp/CmdLine/Compiler
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/dcomp/CmdLine/Compiler/UAnalyzer.pas
r91 r92 5 5 type 6 6 TAnalyzer = class 7 procedure Analyze; 7 procedure Analyze; virtual; 8 8 end; 9 10 TAnalyzerClass = class of TAnalyzer; 9 11 10 12 implementation -
branches/dcomp/CmdLine/Compiler/UCompiler.pas
r91 r92 7 7 8 8 type 9 10 { TCompiler } 11 9 12 TCompiler = class 13 Analyzers: array of TAnalyzer; 10 14 Targets: array of TTarget; 11 15 Analyzer: TAnalyzer; … … 13 17 procedure Compile; 14 18 procedure RegisterTarget(TargetClass: TTargetClass); 19 procedure RegisterAnalyzer(AnalyzerClass: TAnalyzerClass); 15 20 end; 16 21 … … 19 24 procedure TCompiler.Compile; 20 25 begin 26 if Assigned(Analyzer) then Analyzer.Analyze 27 else raise Exception.Create('Undefined analyzer'); 21 28 if Assigned(Target) then Target.Produce 22 29 else raise Exception.Create('Undefined target'); … … 32 39 end; 33 40 41 procedure TCompiler.RegisterAnalyzer(AnalyzerClass: TAnalyzerClass); 42 begin 43 SetLength(Analyzers, Length(Analyzers) + 1); 44 Analyzers[Length(Analyzers) - 1] := AnalyzerClass.Create; 45 if not Assigned(Analyzer) then 46 Analyzer := Analyzers[Length(Analyzers) - 1]; 47 end; 48 34 49 end.
Note:
See TracChangeset
for help on using the changeset viewer.