1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-28 12:02:15 -05:00

Added operator support for arrays: "=", "<>", "+". Still in test phase, still needs support for static arrays.

This commit is contained in:
Niels 2010-08-06 15:47:03 +02:00
parent 8cf4c7adbb
commit cd8d3a7a84
3 changed files with 40 additions and 4 deletions

View File

@ -616,7 +616,8 @@ begin
ScriptErrorLine:= -1;
OwnerSheet.Caption:= ScriptName;
SynEdit.Highlighter := SimbaForm.CurrHighlighter;
SynEdit.Options:= SynEdit.Options + [eoTabIndent] - [eoSmartTabs];
SynEdit.Options := SynEdit.Options + [eoTabIndent, eoKeepCaretX, eoDragDropEditing] - [eoSmartTabs];
SynEdit.Options2 := SynEdit.Options2 + [eoCaretSkipsSelection];
SynEdit.IncrementColor.Background := $30D070;
SynEdit.HighlightAllColor.Background:= clYellow;
SynEdit.HighlightAllColor.Foreground:= clDefault;
@ -638,7 +639,6 @@ begin
end;
AddKey(SynEdit,ecCodeCompletion,VK_SPACE,[ssCtrl]);
AddKey(SynEdit,ecCodeHints,VK_SPACE,[ssCtrl,ssShift]);
// TSynPasSyn(SynEdit.Highlighter).NestedComments:= false; Does not work :(
end;
initialization

View File

@ -8194,6 +8194,10 @@ function TPSPascalCompiler.ProcessSub(BlockInfo: TPSBlockInfo): Boolean;
((t2.BaseType = btString) or (t2.BaseType = btChar) or (t2.BaseType = btPchar) or (t2.BaseType = btWideString) or (t2.BaseType = btWideChar) or (t2.BaseType = btUnicodeString)) then
Result := at2ut(FindBaseType(btWideString))
{$ENDIF}
else if (t1.BaseType = btArray) and (t1 = t2) then
Result := t1
else
Result := nil;
end;

View File

@ -5065,7 +5065,18 @@ begin
Set_Equal(var1, var2, TPSTypeRec_Record(var1Type).RealSize, b);
b := not b;
end else result := False;
end
end;
btArray:
begin
if (var1Type = var2Type) or ((var2Type.BaseType = btArray) and (TPSTypeRec_Array(var1Type).FArrayType = TPSTypeRec_Array(var2Type).FArrayType)) then
begin
if (PSDynArrayGetLength(Pointer(var1^), var1Type) <> PSDynArrayGetLength(Pointer(var2^), var2Type)) then
b := False
else
Set_Equal(Pointer(var1^), Pointer(var2^), PSDynArrayGetLength(Pointer(var1^), var1Type) * TPSTypeRec_Array(var1Type).FArrayType.RealSize, b);
b := not b;
end else result := False;
end;
else begin
CMD_Err(erTypeMismatch);
@ -5173,7 +5184,18 @@ begin
begin
Set_Equal(var1, var2, TPSTypeRec_Record(var1Type).RealSize, b);
end else result := False;
end
end;
btArray:
begin
if (var1Type = var2Type) or ((var2Type.BaseType = btArray) and (TPSTypeRec_Array(var1Type).FArrayType = TPSTypeRec_Array(var2Type).FArrayType)) then
begin
if (PSDynArrayGetLength(Pointer(var1^), var1Type) <> PSDynArrayGetLength(Pointer(var2^), var2Type)) then
b := False
else
Set_Equal(Pointer(var1^), Pointer(var2^), PSDynArrayGetLength(Pointer(var1^), var1Type) * TPSTypeRec_Array(var1Type).FArrayType.RealSize, b);
end else result := False;
end;
else begin
CMD_Err(erTypeMismatch);
exit;
@ -5480,6 +5502,16 @@ begin
end else result := False;
end;
btArray:
begin
if (var1Type = var2Type) or ((var2Type.BaseType = btArray) and (TPSTypeRec_Array(var1Type).FArrayType = TPSTypeRec_Array(var2Type).FArrayType)) then
begin
tvar := PSDynArrayGetLength(Pointer(var1^), var1Type);
PSDynArraySetLength(Pointer(var1^), var1Type, tvar + PSDynArrayGetLength(Pointer(var2^), var2Type));
CopyArrayContents(Pointer(PtrInt(var1^) + Integer(tvar) * TPSTypeRec_Array(var1Type).ArrayType.RealSize), Pointer(var2^), PSDynArrayGetLength(Pointer(var2^), var2Type), TPSTypeRec_Array(var1Type).ArrayType);
end else result := False;
end;
else begin
CMD_Err(erTypeMismatch);
exit;