codetools: clean up

git-svn-id: trunk@20317 -
This commit is contained in:
mattias 2009-05-30 17:34:18 +00:00
parent 66278c69d1
commit c7b2a8b99e
2 changed files with 33 additions and 9 deletions

View File

@ -125,6 +125,8 @@ type
Step: integer; // starting at 0 Step: integer; // starting at 0
out CodeBuffers: TFPList // stopping when CodeBuffers=nil out CodeBuffers: TFPList // stopping when CodeBuffers=nil
) of object; ) of object;
TOnGetFABNestedComments = procedure(Sender: TObject; Code: TCodeBuffer;
out NestedComments) of object;
TFABIndentationPolicy = record TFABIndentationPolicy = record
Indent: integer; Indent: integer;
@ -177,6 +179,7 @@ type
private private
FOnGetExamples: TOnGetFABExamples; FOnGetExamples: TOnGetFABExamples;
FCodePolicies: TAVLTree;// tree of TFABPolicies sorted for Code FCodePolicies: TAVLTree;// tree of TFABPolicies sorted for Code
FOnGetNestedComments: TOnGetFABNestedComments;
procedure ParseSource(const Src: string; StartPos, EndPos: integer; procedure ParseSource(const Src: string; StartPos, EndPos: integer;
NestedComments: boolean; NestedComments: boolean;
Stack: TFABBlockStack; Policies: TFABPolicies); Stack: TFABBlockStack; Policies: TFABPolicies);
@ -197,7 +200,10 @@ type
- learn from sources - learn from sources
- learn from nearest lines in source - learn from nearest lines in source
} }
property OnGetExamples: TOnGetFABExamples read FOnGetExamples write FOnGetExamples; property OnGetExamples: TOnGetFABExamples read FOnGetExamples
write FOnGetExamples;
property OnGetNestedComments: TOnGetFABNestedComments
read FOnGetNestedComments write FOnGetNestedComments;
end; end;
const const
@ -795,6 +801,8 @@ function TFullyAutomaticBeautifier.GetNestedCommentsForCode(Code: TCodeBuffer
): boolean; ): boolean;
begin begin
Result:=true; Result:=true;
if Assigned(OnGetNestedComments) then
OnGetNestedComments(Self,Code,Result);
end; end;
constructor TFullyAutomaticBeautifier.Create; constructor TFullyAutomaticBeautifier.Create;

View File

@ -112,7 +112,7 @@ type
procedure EndComment(CommentStart: char; p: integer); procedure EndComment(CommentStart: char; p: integer);
public public
LineLength: integer; LineLength: integer;
LineEnd: string; // default: #13#10 LineEnd: string;
Indent: integer; Indent: integer;
TabWidth: integer; TabWidth: integer;
KeyWordPolicy: TWordPolicy; KeyWordPolicy: TWordPolicy;
@ -164,7 +164,7 @@ type
{ TSourceChangeCache } { TSourceChangeCache }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// in front of and after a text change can be set a gap. // in front of and after a text change can a gap be set.
// A Gap is for example a space char or a newline. TSourceChangeLog will add // A Gap is for example a space char or a newline. TSourceChangeLog will add
// the gap if it is not already in the code // the gap if it is not already in the code
TGapTyp = (gtNone, // no special gap TGapTyp = (gtNone, // no special gap
@ -259,10 +259,23 @@ type
const const
AtomTypeNames: array[TAtomType] of shortstring = ( AtomTypeNames: array[TAtomType] of shortstring = (
'None', 'Keyword', 'Identifier', 'Colon', 'Semicolon', 'Comma', 'Point', 'None',
'At', 'Number', 'StringConstant', 'NewLine', 'Space', 'Keyword',
'CommentStart', 'DirectiveStart', 'CommentEnd', 'Identifier',
'Symbol', 'Bracket' 'Colon',
'Semicolon',
'Comma',
'Point',
'At',
'Number',
'StringConstant',
'NewLine',
'Space',
'CommentStart',
'DirectiveStart',
'CommentEnd',
'Symbol',
'Bracket'
); );
WordPolicyNames: array[TWordPolicy] of shortstring = ( WordPolicyNames: array[TWordPolicy] of shortstring = (
@ -278,8 +291,11 @@ const
); );
ForwardProcBodyInsertPolicyNames: array[TForwardProcBodyInsertPolicy] of ForwardProcBodyInsertPolicyNames: array[TForwardProcBodyInsertPolicy] of
shortstring = shortstring = (
('Last', 'InFrontOfMethods', 'BehindMethods'); 'Last',
'InFrontOfMethods',
'BehindMethods'
);
UsesInsertPolicyNames: array[TUsesInsertPolicy] of shortstring = ( UsesInsertPolicyNames: array[TUsesInsertPolicy] of shortstring = (
'First', 'First',