Changeset 49 for branches/DelphiToC/UPascalCompiler.pas
- Timestamp:
- Aug 9, 2010, 2:24:24 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DelphiToC/UPascalCompiler.pas
r48 r49 8 8 SysUtils, Variants, Classes, Graphics, Controls, Forms, 9 9 Dialogs, UPascalSource, UCodeProducer, UPascalParser, 10 UProducerC ;10 UProducerC, Contnrs; 11 11 12 12 type 13 14 TErrorMessage = class 15 Text: string; 16 Position: TPoint; 17 end; 13 18 14 19 { TCompiler } … … 17 22 private 18 23 FOnErrorMessage: TOnErrorMessage; 19 procedure ErrorMessage(Text: string );24 procedure ErrorMessage(Text: string; Position: TPoint); 20 25 procedure InitSystem; 21 26 public … … 24 29 Parser: TPascalParser; 25 30 Producer: TCodeProducer; 31 ErrorMessages: TObjectList; 26 32 constructor Create; 27 33 procedure Compile; … … 37 43 begin 38 44 InitSystem; 45 ErrorMessages.Clear; 39 46 Parser.Init; 40 47 Parser.ParseAll(ProgramCode); … … 51 58 Parser.SourceCodeText := SourceCode; 52 59 Parser.OnErrorMessage := ErrorMessage; 60 ErrorMessages := TObjectList.Create; 53 61 end; 54 62 … … 59 67 Parser.Free; 60 68 Producer.Free; 69 ErrorMessages.Free; 61 70 end; 62 71 63 procedure TCompiler.ErrorMessage(Text: string); 72 procedure TCompiler.ErrorMessage(Text: string; Position: TPoint); 73 var 74 NewMessage: TErrorMessage; 64 75 begin 65 if Assigned(FOnErrorMessage) then FOnErrorMessage(Text); 76 NewMessage := TErrorMessage.Create; 77 NewMessage.Text := Text; 78 NewMessage.Position := Position; 79 ErrorMessages.Add(NewMessage); 80 if Assigned(FOnErrorMessage) then FOnErrorMessage(Text, Position); 66 81 end; 67 82
Note:
See TracChangeset
for help on using the changeset viewer.