codetools: auto indent: edged brackets

git-svn-id: trunk@22315 -
This commit is contained in:
mattias 2009-10-28 10:35:28 +00:00
parent 5cde48e398
commit 50a2f313be

View File

@ -105,6 +105,7 @@ type
bbtClassInterface, bbtClassInterface,
bbtClassSection, // public, private, protected, published bbtClassSection, // public, private, protected, published
bbtTypeRoundBracket, bbtTypeRoundBracket,
bbtTypeEdgedBracket,
// statement blocks // statement blocks
bbtProcedure, // procedure, constructor, destructor bbtProcedure, // procedure, constructor, destructor
bbtFunction, bbtFunction,
@ -125,7 +126,8 @@ type
bbtIfThen, // child of bbtIf bbtIfThen, // child of bbtIf
bbtIfElse, // child of bbtIf bbtIfElse, // child of bbtIf
bbtIfBegin, // child of bbtIfThen or bbtIfElse bbtIfBegin, // child of bbtIfThen or bbtIfElse
bbtStatementRoundBracket bbtStatementRoundBracket,
bbtStatementEdgedBracket
); );
TFABBlockTypes = set of TFABBlockType; TFABBlockTypes = set of TFABBlockType;
@ -137,7 +139,8 @@ const
bbtAllStatements = [bbtMainBegin,bbtFreeBegin,bbtRepeat,bbtProcedureBegin, bbtAllStatements = [bbtMainBegin,bbtFreeBegin,bbtRepeat,bbtProcedureBegin,
bbtCaseColon,bbtCaseBegin,bbtCaseElse, bbtCaseColon,bbtCaseBegin,bbtCaseElse,
bbtTry,bbtFinally,bbtExcept, bbtTry,bbtFinally,bbtExcept,
bbtIfThen,bbtIfElse,bbtIfBegin,bbtStatementRoundBracket]; bbtIfThen,bbtIfElse,bbtIfBegin,
bbtStatementRoundBracket,bbtStatementEdgedBracket];
const const
FABBlockTypeNames: array[TFABBlockType] of string = ( FABBlockTypeNames: array[TFABBlockType] of string = (
'bbtNone', 'bbtNone',
@ -159,6 +162,7 @@ const
'bbtClassInterface', 'bbtClassInterface',
'bbtClassSection', 'bbtClassSection',
'bbtTypeRoundBracket', 'bbtTypeRoundBracket',
'bbtTypeEdgedBracket',
// statement blocks // statement blocks
'bbtProcedure', 'bbtProcedure',
'bbtFunction', 'bbtFunction',
@ -179,7 +183,8 @@ const
'bbtIfThen', 'bbtIfThen',
'bbtIfElse', 'bbtIfElse',
'bbtIfBegin', 'bbtIfBegin',
'bbtStatementRoundBracket' 'bbtStatementRoundBracket',
'bbtStatementEdgedBracket'
); );
type type
@ -585,6 +590,22 @@ begin
BeginBlock(bbtTypeRoundBracket); BeginBlock(bbtTypeRoundBracket);
end; end;
end; end;
']':
if p-AtomStart=1 then begin
// edged bracket close
case Stack.TopType of
bbtTypeEdgedBracket,bbtStatementEdgedBracket:
EndBlock;
end;
end;
'[':
if p-AtomStart=1 then begin
// edged bracket open
if Stack.TopType in bbtAllStatements then
BeginBlock(bbtStatementEdgedBracket)
else
BeginBlock(bbtTypeEdgedBracket);
end;
')': ')':
if p-AtomStart=1 then begin if p-AtomStart=1 then begin
// round bracket close // round bracket close