mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 13:19:20 +02:00
codetools: auto indent: ignore brackets in statements
git-svn-id: trunk@22397 -
This commit is contained in:
parent
91dd143c43
commit
db15a33457
@ -94,7 +94,7 @@ type
|
|||||||
bbtClassInterface,
|
bbtClassInterface,
|
||||||
bbtClassSection, // public, private, protected, published
|
bbtClassSection, // public, private, protected, published
|
||||||
bbtTypeRoundBracket,
|
bbtTypeRoundBracket,
|
||||||
bbtTypeEdgeBracket,
|
bbtTypeEdgedBracket,
|
||||||
// statement blocks
|
// statement blocks
|
||||||
bbtProcedure, // procedure, constructor, destructor
|
bbtProcedure, // procedure, constructor, destructor
|
||||||
bbtFunction, // function, operator
|
bbtFunction, // function, operator
|
||||||
@ -118,7 +118,7 @@ type
|
|||||||
bbtIfElse, // child of bbtIf
|
bbtIfElse, // child of bbtIf
|
||||||
bbtIfBegin, // child of bbtIfThen or bbtIfElse
|
bbtIfBegin, // child of bbtIfThen or bbtIfElse
|
||||||
bbtStatementRoundBracket,
|
bbtStatementRoundBracket,
|
||||||
bbtStatementEdgeBracket
|
bbtStatementEdgedBracket
|
||||||
);
|
);
|
||||||
TFABBlockTypes = set of TFABBlockType;
|
TFABBlockTypes = set of TFABBlockType;
|
||||||
|
|
||||||
@ -132,9 +132,9 @@ const
|
|||||||
bbtCaseColon,bbtCaseBegin,bbtCaseElse,
|
bbtCaseColon,bbtCaseBegin,bbtCaseElse,
|
||||||
bbtTry,bbtFinally,bbtExcept,
|
bbtTry,bbtFinally,bbtExcept,
|
||||||
bbtIfThen,bbtIfElse,bbtIfBegin,
|
bbtIfThen,bbtIfElse,bbtIfBegin,
|
||||||
bbtStatementRoundBracket,bbtStatementEdgeBracket];
|
bbtStatementRoundBracket,bbtStatementEdgedBracket];
|
||||||
bbtAllBrackets = [bbtTypeRoundBracket,bbtTypeEdgeBracket,
|
bbtAllBrackets = [bbtTypeRoundBracket,bbtTypeEdgedBracket,
|
||||||
bbtStatementRoundBracket,bbtStatementEdgeBracket];
|
bbtStatementRoundBracket,bbtStatementEdgedBracket];
|
||||||
const
|
const
|
||||||
FABBlockTypeNames: array[TFABBlockType] of string = (
|
FABBlockTypeNames: array[TFABBlockType] of string = (
|
||||||
'bbtNone',
|
'bbtNone',
|
||||||
@ -157,7 +157,7 @@ const
|
|||||||
'bbtClassInterface',
|
'bbtClassInterface',
|
||||||
'bbtClassSection',
|
'bbtClassSection',
|
||||||
'bbtTypeRoundBracket',
|
'bbtTypeRoundBracket',
|
||||||
'bbtTypeEdgeBracket',
|
'bbtTypeEdgedBracket',
|
||||||
// statement blocks
|
// statement blocks
|
||||||
'bbtProcedure',
|
'bbtProcedure',
|
||||||
'bbtFunction',
|
'bbtFunction',
|
||||||
@ -181,7 +181,7 @@ const
|
|||||||
'bbtIfElse',
|
'bbtIfElse',
|
||||||
'bbtIfBegin',
|
'bbtIfBegin',
|
||||||
'bbtStatementRoundBracket',
|
'bbtStatementRoundBracket',
|
||||||
'bbtStatementEdgeBracket'
|
'bbtStatementEdgedBracket'
|
||||||
);
|
);
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -987,16 +987,17 @@ begin
|
|||||||
bbtProcedureHead:
|
bbtProcedureHead:
|
||||||
BeginBlock(bbtProcedureParamList);
|
BeginBlock(bbtProcedureParamList);
|
||||||
else
|
else
|
||||||
if Stack.TopType in bbtAllStatements then
|
if Stack.TopType in bbtAllStatements then begin
|
||||||
BeginBlock(bbtStatementRoundBracket)
|
// ignore brackets in statements, there are no consistent rules
|
||||||
else
|
// to indent them
|
||||||
|
end else
|
||||||
BeginBlock(bbtTypeRoundBracket);
|
BeginBlock(bbtTypeRoundBracket);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
')':
|
')':
|
||||||
if p-AtomStart=1 then begin
|
if p-AtomStart=1 then begin
|
||||||
// round bracket close
|
// round bracket close
|
||||||
EndTopMostBlock(bbtStatementEdgeBracket);
|
EndTopMostBlock(bbtStatementEdgedBracket);
|
||||||
case Stack.TopType of
|
case Stack.TopType of
|
||||||
bbtProcedureParamList,bbtTypeRoundBracket,bbtStatementRoundBracket:
|
bbtProcedureParamList,bbtTypeRoundBracket,bbtStatementRoundBracket:
|
||||||
EndBlock;
|
EndBlock;
|
||||||
@ -1006,16 +1007,16 @@ begin
|
|||||||
if p-AtomStart=1 then begin
|
if p-AtomStart=1 then begin
|
||||||
// edge bracket open
|
// edge bracket open
|
||||||
if Stack.TopType in bbtAllStatements then
|
if Stack.TopType in bbtAllStatements then
|
||||||
BeginBlock(bbtStatementEdgeBracket)
|
BeginBlock(bbtStatementEdgedBracket)
|
||||||
else
|
else
|
||||||
BeginBlock(bbtTypeEdgeBracket);
|
BeginBlock(bbtTypeEdgedBracket);
|
||||||
end;
|
end;
|
||||||
']':
|
']':
|
||||||
if p-AtomStart=1 then begin
|
if p-AtomStart=1 then begin
|
||||||
// edge bracket close
|
// edge bracket close
|
||||||
EndTopMostBlock(bbtStatementRoundBracket);
|
EndTopMostBlock(bbtStatementRoundBracket);
|
||||||
case Stack.TopType of
|
case Stack.TopType of
|
||||||
bbtTypeEdgeBracket,bbtStatementEdgeBracket:
|
bbtTypeEdgedBracket,bbtStatementEdgedBracket:
|
||||||
EndBlock;
|
EndBlock;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user