Skip to content

Commit

Permalink
Tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
ollydev committed Oct 20, 2024
1 parent 543c701 commit 6e309c3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 21 deletions.
39 changes: 20 additions & 19 deletions Source/ide/codetools/simba.ide_codetools_arrayhelpers.pas
Original file line number Diff line number Diff line change
Expand Up @@ -72,47 +72,48 @@ interface
'procedure <ArrayName>.Append(Value: <ArrayVarType>); external;' + LineEnding +
'procedure <ArrayName>.Extend(Value: <ArrayName>); external;';

// var x: array of SomeType;
HELPERS_DYNARRAY_UNTYPED =
'function <ArrayName>.Low: Integer; external;' + LineEnding +
'function <ArrayName>.High: Integer; external;' + LineEnding +
'function <ArrayName>.Contains(Value: array of <ArrayVarType>): Boolean; external;' + LineEnding +
'function <ArrayName>.Contains(Value: <ArrayVarType>): Boolean; external;' + LineEnding +
'procedure <ArrayName>.Swap(FromIndex, ToIndex: Integer); external;' + LineEnding +
'function <ArrayName>.Unique: array of <ArrayVarType>; external;' + LineEnding +
'function <ArrayName>.IndexOf(Value: array of <ArrayVarType>): Integer; external;' + LineEnding +
'function <ArrayName>.IndicesOf(Value: array of <ArrayVarType>): TIntegerArray; external;' + LineEnding +
'function <ArrayName>.IndexOf(Value: <ArrayVarType>): Integer; external;' + LineEnding +
'function <ArrayName>.IndicesOf(Value: <ArrayVarType>): TIntegerArray; external;' + LineEnding +
'procedure <ArrayName>.Sort; external;' + LineEnding +
'procedure <ArrayName>.Sort(CompareFunc: function(constref L, R: array of <ArrayVarType>): Integer); external;' + LineEnding +
'procedure <ArrayName>.Sort(CompareFunc: function(constref L, R: <ArrayVarType>): Integer); external;' + LineEnding +
'procedure <ArrayName>.Sort(Weights: TIntegerArray; LowToHigh: Boolean); external;' + LineEnding +
'function <ArrayName>.Sorted: array of <ArrayVarType>; external;' + LineEnding +
'function <ArrayName>.Sorted(CompareFunc: function(constref L, R: array of <ArrayVarType>): Integer): array of <ArrayVarType>; external;' + LineEnding +
'function <ArrayName>.Sorted(CompareFunc: function(constref L, R: <ArrayVarType>): Integer): array of <ArrayVarType>; external;' + LineEnding +
'function <ArrayName>.Sorted(Weights: TIntegerArray; LowToHigh: Boolean): array of <ArrayVarType>; external;' + LineEnding +
'function <ArrayName>.Length: Integer; external;' + LineEnding +
'function <ArrayName>.Copy: array of <ArrayVarType>; external;' + LineEnding +
'function <ArrayName>.Copy(StartIndex: Integer; Count: Integer = High(Integer)): array of <ArrayVarType>; external;' + LineEnding +
'function <ArrayName>.First: array of <ArrayVarType>; external;' + LineEnding +
'function <ArrayName>.Last: array of <ArrayVarType>; external;' + LineEnding +
'function <ArrayName>.RandomValue: array of <ArrayVarType>; external;' + LineEnding +
'function <ArrayName>.First: <ArrayVarType>; external;' + LineEnding +
'function <ArrayName>.Last: <ArrayVarType>; external;' + LineEnding +
'function <ArrayName>.RandomValue: <ArrayVarType>; external;' + LineEnding +
'function <ArrayName>.Reversed: array of <ArrayVarType>; external;' + LineEnding +
'function <ArrayName>.Min: array of <ArrayVarType>; external;' + LineEnding +
'function <ArrayName>.Max: array of <ArrayVarType>; external;' + LineEnding +
'function <ArrayName>.Sum: array of <ArrayVarType>; external;' + LineEnding +
'function <ArrayName>.Mode: array of <ArrayVarType>; external;' + LineEnding +
'function <ArrayName>.Min: <ArrayVarType>; external;' + LineEnding +
'function <ArrayName>.Max: <ArrayVarType>; external;' + LineEnding +
'function <ArrayName>.Sum: <ArrayVarType>; external;' + LineEnding +
'function <ArrayName>.Mode: <ArrayVarType>; external;' + LineEnding +
'function <ArrayName>.Median: Double; external;' + LineEnding +
'function <ArrayName>.Mean: Double; external;' + LineEnding +
'function <ArrayName>.Variance: Double; external;' + LineEnding +
'function <ArrayName>.Stdev: Double; external;' + LineEnding +
'function <ArrayName>.Slice(Start, Stop, Step: Integer): array of <ArrayVarType>; external;' + LineEnding +
'function <ArrayName>.Remove(Value: array of <ArrayVarType>): Boolean; external;' + LineEnding +
'function <ArrayName>.RemoveAll(Value: array of <ArrayVarType>): Integer; external;' + LineEnding +
'function <ArrayName>.Remove(Value: <ArrayVarType>): Boolean; external;' + LineEnding +
'function <ArrayName>.RemoveAll(Value: <ArrayVarType>): Integer; external;' + LineEnding +
'procedure <ArrayName>.Delete(Index: Integer; Count: Integer = High(Integer)); external;' + LineEnding +
'procedure <ArrayName>.Insert(Item: array of <ArrayVarType>; Index: Integer); external;' + LineEnding +
'procedure <ArrayName>.Insert(Item: <ArrayVarType>; Index: Integer); external;' + LineEnding +
'procedure <ArrayName>.SetLength(NewLength: Integer); external;' + LineEnding +
'function <ArrayName>.Pop: array of <ArrayVarType>; external;' + LineEnding +
'function <ArrayName>.Pop(Index: Integer): array of <ArrayVarType>; external;' + LineEnding +
'function <ArrayName>.RandomValue: array of <ArrayVarType>; external;' + LineEnding +
'function <ArrayName>.Pop: <ArrayVarType>; external;' + LineEnding +
'function <ArrayName>.Pop(Index: Integer): <ArrayVarType>; external;' + LineEnding +
'function <ArrayName>.RandomValue: <ArrayVarType>; external;' + LineEnding +
'procedure <ArrayName>.Reverse; external;' + LineEnding +
'procedure <ArrayName>.Clear; external;' + LineEnding +
'procedure <ArrayName>.Append(Value: array of <ArrayVarType>); external;' + LineEnding +
'procedure <ArrayName>.Append(Value: <ArrayVarType>); external;' + LineEnding +
'procedure <ArrayName>.Extend(Value: array of <ArrayVarType>); external;';

HELPERS_STATICARRAY =
Expand Down
9 changes: 7 additions & 2 deletions Source/ide/simba.ide_editor_docgenerator.pas
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ interface
'(*' + LineEnding +
'%s' + LineEnding +
'%s' + LineEnding +
'> %s' + LineEnding +
'```' + LineEnding +
'%s' + LineEnding +
'```' + LineEnding +
'*)' + LineEnding;

type
Expand All @@ -36,7 +38,8 @@ TSimbaEditorPlugin_DocGenerator = class(TLazSynEditPlugin)
implementation

uses
simba.ide_codetools_base, simba.ide_codetools_parser, simba.settings;
simba.ide_codetools_base, simba.ide_codetools_parser, simba.settings,
simba.dialog;

procedure TSimbaEditorPlugin_DocGenerator.DoEditorAdded(Value: TCustomSynEdit);
begin
Expand Down Expand Up @@ -97,6 +100,8 @@ procedure TSimbaEditorPlugin_DocGenerator.InsertDocumentation;
InsertDocAtMethod(Decl.ParentByClass[TDeclaration_Method]);
end;
except
on E: Exception do
SimbaErrorDlg('Simba', 'Insert documentation error: %s', [E.Message]);
end;
if (Parser <> nil) then
Parser.Free();
Expand Down

0 comments on commit 6e309c3

Please sign in to comment.