+ Added format in interface

+ Some errors in parser fixed, it uses exceptions now
+ Strings now has no more syntax errors.
This commit is contained in:
michael 1998-10-30 14:52:48 +00:00
parent b531870903
commit f122915f75
4 changed files with 47 additions and 41 deletions

View File

@ -32,14 +32,6 @@
{ Utility routines }
{$i util.inc}
{!!!TSE 21.09.1998 reimplements exceptions classes}
{$IFNDEF USE_EXCEPTIONS}
constructor Exception.Create(Msg : String);
begin
inherited Create;
end;
{$ENDIF}
{ TBits implementation }
{$i bits.inc}
@ -370,7 +362,12 @@ end;
{
$Log$
Revision 1.6 1998-10-29 12:47:14 michael
Revision 1.7 1998-10-30 14:52:48 michael
+ Added format in interface
+ Some errors in parser fixed, it uses exceptions now
+ Strings now has no more syntax errors.
Revision 1.6 1998/10/29 12:47:14 michael
+ Implementation of tpoint by WYB
Revision 1.5 1998/09/23 08:41:55 michael
@ -415,7 +412,12 @@ end;
{
$Log$
Revision 1.6 1998-10-29 12:47:14 michael
Revision 1.7 1998-10-30 14:52:48 michael
+ Added format in interface
+ Some errors in parser fixed, it uses exceptions now
+ Strings now has no more syntax errors.
Revision 1.6 1998/10/29 12:47:14 michael
+ Implementation of tpoint by WYB
Revision 1.5 1998/09/23 08:41:55 michael
@ -433,4 +435,4 @@ end;
Revision 1.1 1998/05/04 12:16:01 florian
+ Initial revisions after making a new directory structure
}
}

View File

@ -776,9 +776,7 @@ type
procedure CheckToken(T: Char);
procedure CheckTokenSymbol(const S: string);
procedure Error(const Ident: string);
{!!!!!!
procedure ErrorFmt(const Ident: string; const Args: array of const);
}
procedure ErrorStr(const Message: string);
procedure HexToBinary(Stream: TStream);
function NextToken: Char;
@ -1051,7 +1049,12 @@ function LineStart(Buffer, BufPos: PChar): PChar;
{
$Log$
Revision 1.9 1998-10-24 13:45:35 michael
Revision 1.10 1998-10-30 14:52:49 michael
+ Added format in interface
+ Some errors in parser fixed, it uses exceptions now
+ Strings now has no more syntax errors.
Revision 1.9 1998/10/24 13:45:35 michael
+ Implemented stringlist. Untested, since classes broken.
Revision 1.8 1998/09/23 07:47:41 michael
@ -1078,4 +1081,4 @@ function LineStart(Buffer, BufPos: PChar): PChar;
Revision 1.1 1998/05/04 12:16:01 florian
+ Initial revisions after making a new directory structure
}
}

View File

@ -122,18 +122,15 @@ begin
toInteger, toFloat:
Error(SNumberExpected);
else
// ErrorFmt(SCharExpected, [T]);
ErrorStr('"' + T + '"' + SCharExpected);
ErrorFmt(SCharExpected, [T]);
end;
end;
end;
procedure TParser.CheckTokenSymbol(const S: string);
begin
if not TokenSymbolIs(S) then begin
// ErrorFmt(SSymbolExpected, [S]);
ErrorStr(S + SSymbolExpected);
end;
if not TokenSymbolIs(S) then
ErrorFmt(SSymbolExpected, [S]);
end;
Procedure TParser.Error(const Ident: string);
@ -141,17 +138,14 @@ begin
ErrorStr(Ident);
end;
{!!!!!!
Procedure TParser.ErrorFmt(const Ident: string; const Args: array of const);
begin
ErrorStr(Format(Ident, Args));
end;
!!!!!!}
Procedure TParser.ErrorStr(const Message: string);
begin
// raise EParserError.CreateFmt(SParseError, [Message, FSourceLine]);
raise EParserError.Create(Message + SParseError + IntToStr(FSourceLine));
raise EParserError.CreateFmt(SParseError, [Message, FSourceLine]);
end;
@ -322,7 +316,12 @@ begin
end;
{
$Log$
Revision 1.3 1998-10-02 22:41:28 michael
Revision 1.4 1998-10-30 14:52:51 michael
+ Added format in interface
+ Some errors in parser fixed, it uses exceptions now
+ Strings now has no more syntax errors.
Revision 1.3 1998/10/02 22:41:28 michael
+ Added exceptions for error handling
Revision 1.2 1998/09/23 07:48:11 michael

View File

@ -562,9 +562,9 @@ Var Extra : Longint;
begin
If FCapacity>64 then
Extra:=FCapacity Div 4;
Extra:=FCapacity Div 4
Else If FCapacity>8 Then
Extra:=16;
Extra:=16
Else
Extra:=4;
SetCapacity(FCapacity+Extra);
@ -574,7 +574,7 @@ end;
Procedure TStringList.QuickSort(L, R: Integer);
Var L,R,I,J : Longint;
Var I,J : Longint;
Pivot : String;
begin
@ -603,10 +603,10 @@ Procedure TStringList.InsertItem(Index: Integer; const S: string);
begin
Changing;
If FCount:=Fcapacity then Grow;
If FCount=Fcapacity then Grow;
If Index<FCount then
System.Move (FList^[Index],FList^[Index+1],SizeOf(TStringItem));
Pointer(Flist^[Index].Fstring:=Nil; // Needed to initialize...
Pointer(Flist^[Index].Fstring):=Nil; // Needed to initialize...
Flist^[Index].FString:=S;
Flist^[Index].Fobject:=Nil;
Inc(FCount);
@ -711,8 +711,8 @@ end;
Procedure TStringList.SetCapacity(NewCapacity: Integer);
Var NewList : Pointer;
Var NewList,ToFree : Pointer;
begin
If (NewCapacity<0) then
Error (SListCapacityError,NewCapacity);
@ -725,7 +725,7 @@ begin
If Assigned(FList) then
begin
System.Move (FList^,NewList^,FCapacity*Sizeof(Pointer));
FillWord (NewList^[FCapacity],(NewCapacity-FCapacity)*WordRatio, 0);
FillWord (Pchar(NewList)[FCapacity],(NewCapacity-FCapacity)*WordRatio, 0);
FreeMem (Flist,FCapacity*SizeOf(Pointer));
end;
Flist:=NewList;
@ -763,7 +763,7 @@ begin
FOnChanging:=Nil;
// This will force a dereference. Can be done better...
For I:=0 to FCount-1 do
FList^.[I].FString:='';
FList^[I].FString:='';
FCount:=0;
SetCapacity(0);
Inherited destroy;
@ -782,7 +782,6 @@ begin
DupIgnore : Exit;
DupError : Error(SDuplicateString,0)
end;
end;
InsertItem (Result,S);
end;
@ -880,21 +879,19 @@ begin
If Sorted then
Error (SSortedListError,0)
else
begin
If (Index<0) or (Index>FCount) then
Error (SListIndexError,Index);
Error (SListIndexError,Index)
else
InsertItem (Index,S);
end;
Procedure TStringList.Sort;
begin
If Not Sorted and FCount>1 then
begin
Changing
Changing;
QuickSOrt(0,FCount-1);
Changed;
end;
@ -902,7 +899,12 @@ end;
{
$Log$
Revision 1.4 1998-10-24 13:45:37 michael
Revision 1.5 1998-10-30 14:52:52 michael
+ Added format in interface
+ Some errors in parser fixed, it uses exceptions now
+ Strings now has no more syntax errors.
Revision 1.4 1998/10/24 13:45:37 michael
+ Implemented stringlist. Untested, since classes broken.
Revision 1.3 1998/05/07 14:16:51 michael