mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-07-24 04:45:55 +02:00
codetools: never add spaces in front of newline and space
git-svn-id: trunk@34971 -
This commit is contained in:
parent
7d4c394fe2
commit
c69b510a58
@ -161,19 +161,19 @@ var
|
|||||||
: TKeyWordFunctionList;
|
: TKeyWordFunctionList;
|
||||||
UpChars: array[char] of char;
|
UpChars: array[char] of char;
|
||||||
|
|
||||||
IsSpaceChar, // [#0..#32]
|
IsSpaceChar, // [#0..#32]
|
||||||
IsLineEndChar,
|
IsLineEndChar, // [#10,#13]
|
||||||
IsWordChar, // ['a'..'z','A'..'Z']
|
IsWordChar, // ['a'..'z','A'..'Z']
|
||||||
IsNonWordChar, // [#0..#127]-IsIdentChar
|
IsNonWordChar, // [#0..#127]-IsIdentChar
|
||||||
IsIdentStartChar,
|
IsIdentStartChar, // ['a'..'z','A'..'Z','_']
|
||||||
IsIdentChar,
|
IsIdentChar, // ['a'..'z','A'..'Z','_','0'..'9']
|
||||||
IsDottedIdentChar,
|
IsDottedIdentChar, // ['.','a'..'z','A'..'Z','_','0'..'9']
|
||||||
IsNumberChar,
|
IsNumberChar, // ['0'..'9']
|
||||||
IsCommentStartChar,
|
IsCommentStartChar,
|
||||||
IsCommentEndChar,
|
IsCommentEndChar,
|
||||||
IsHexNumberChar,
|
IsHexNumberChar, // ['0'..'9','a'..'f','A'..'F']
|
||||||
IsEqualOperatorStartChar,
|
IsEqualOperatorStartChar, // [':','+','-','/','*','<','>']
|
||||||
IsAfterFloatPointChar:
|
IsAfterFloatPointChar: // ['0'..'9','e','E']
|
||||||
array[char] of boolean;
|
array[char] of boolean;
|
||||||
|
|
||||||
function UpperCaseStr(const s: string): string;
|
function UpperCaseStr(const s: string): string;
|
||||||
|
@ -1634,6 +1634,8 @@ var
|
|||||||
OldIndent: Integer;
|
OldIndent: Integer;
|
||||||
OldAtomStart: LongInt;
|
OldAtomStart: LongInt;
|
||||||
AfterProcedure: Boolean;
|
AfterProcedure: Boolean;
|
||||||
|
CurDoNotInsertSpaceAfter: TAtomTypes;
|
||||||
|
CurDoNotInsertSpaceInFront: TAtomTypes;
|
||||||
begin
|
begin
|
||||||
//DebugLn('**********************************************************');
|
//DebugLn('**********************************************************');
|
||||||
//DebugLn('[TBeautifyCodeOptions.BeautifyStatement] "',AStatement,'"');
|
//DebugLn('[TBeautifyCodeOptions.BeautifyStatement] "',AStatement,'"');
|
||||||
@ -1641,6 +1643,8 @@ begin
|
|||||||
// set flags
|
// set flags
|
||||||
CurFlags:=BeautifyFlags;
|
CurFlags:=BeautifyFlags;
|
||||||
OldIndent:=Indent;
|
OldIndent:=Indent;
|
||||||
|
CurDoNotInsertSpaceAfter:=DoNotInsertSpaceAfter+[atNewLine,atSpace];
|
||||||
|
CurDoNotInsertSpaceInFront:=DoNotInsertSpaceInFront+[atNewLine,atSpace];
|
||||||
try
|
try
|
||||||
if bcfNoIndentOnBreakLine in CurFlags then
|
if bcfNoIndentOnBreakLine in CurFlags then
|
||||||
Indent:=0;
|
Indent:=0;
|
||||||
@ -1696,10 +1700,10 @@ begin
|
|||||||
and (SameText(CurAtom, 'procedure') or SameText(CurAtom, 'function'))
|
and (SameText(CurAtom, 'procedure') or SameText(CurAtom, 'function'))
|
||||||
then
|
then
|
||||||
AfterProcedure := True;
|
AfterProcedure := True;
|
||||||
//DebugLn(['TBeautifyCodeOptions.BeautifyStatement ',CurAtom,' LastAtomType=',AtomTypeNames[LastAtomType],',',LastAtomType in DoNotInsertSpaceAfter,',',LastAtomType in DoInsertSpaceAfter,' CurAtomType=',AtomTypeNames[CurAtomType],',',CurAtomType in DoNotInsertSpaceInFront,',',CurAtomType in DoInsertSpaceInFront]);
|
//DebugLn(['TBeautifyCodeOptions.BeautifyStatement ',CurAtom,' LastAtomType=',AtomTypeNames[LastAtomType],',',LastAtomType in CurDoNotInsertSpaceAfter,',',LastAtomType in DoInsertSpaceAfter,' CurAtomType=',AtomTypeNames[CurAtomType],',',CurAtomType in CurDoNotInsertSpaceInFront,',',CurAtomType in DoInsertSpaceInFront]);
|
||||||
if ((Result='') or (Result[length(Result)]<>' '))
|
if ((Result='') or (not IsSpaceChar[Result[length(Result)]]))
|
||||||
and (not (CurAtomType in DoNotInsertSpaceInFront))
|
and (not (CurAtomType in CurDoNotInsertSpaceInFront))
|
||||||
and (not (LastAtomType in DoNotInsertSpaceAfter))
|
and (not (LastAtomType in CurDoNotInsertSpaceAfter))
|
||||||
and ((CurAtomType in DoInsertSpaceInFront)
|
and ((CurAtomType in DoInsertSpaceInFront)
|
||||||
or (LastAtomType in DoInsertSpaceAfter))
|
or (LastAtomType in DoInsertSpaceAfter))
|
||||||
then begin
|
then begin
|
||||||
|
Loading…
Reference in New Issue
Block a user