mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-23 01:50:30 +01:00
Jedi code format: add support for record alignment directive.
This commit is contained in:
parent
afae7dfa87
commit
839c4e8307
@ -2186,6 +2186,11 @@ begin
|
|||||||
begin
|
begin
|
||||||
RecogniseRecordBody;
|
RecogniseRecordBody;
|
||||||
Recognise(ttEnd);
|
Recognise(ttEnd);
|
||||||
|
if fcTokenList.FirstSolidTokenType = ttAlign then
|
||||||
|
begin
|
||||||
|
Recognise(ttAlign);
|
||||||
|
RecogniseConstantExpression;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
RecogniseHintDirectives;
|
RecogniseHintDirectives;
|
||||||
|
|||||||
@ -155,6 +155,7 @@ type
|
|||||||
|
|
||||||
{ reserved words that are directives }
|
{ reserved words that are directives }
|
||||||
ttAbsolute,
|
ttAbsolute,
|
||||||
|
ttAlign,
|
||||||
ttExternal,
|
ttExternal,
|
||||||
ttPascal,
|
ttPascal,
|
||||||
ttSafecall,
|
ttSafecall,
|
||||||
@ -681,6 +682,7 @@ begin
|
|||||||
AddKeyword('package', wtReservedWordDirective, ttPackage);
|
AddKeyword('package', wtReservedWordDirective, ttPackage);
|
||||||
AddKeyword('contains', wtReservedWordDirective, ttContains);
|
AddKeyword('contains', wtReservedWordDirective, ttContains);
|
||||||
AddKeyword('requires', wtReservedWordDirective, ttRequires);
|
AddKeyword('requires', wtReservedWordDirective, ttRequires);
|
||||||
|
AddKeyword('align', wtReservedWordDirective, ttAlign);
|
||||||
|
|
||||||
{ reseved words that are directives }
|
{ reseved words that are directives }
|
||||||
AddKeyword('absolute', wtReservedWordDirective, ttAbsolute);
|
AddKeyword('absolute', wtReservedWordDirective, ttAbsolute);
|
||||||
|
|||||||
@ -91,6 +91,10 @@ begin
|
|||||||
if pt.HasParentNode(nAsm) then
|
if pt.HasParentNode(nAsm) then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
|
{ after record ... end align XX; }
|
||||||
|
if (pt.TokenType = ttAlign) and pt.HasParentNode(nRecordType, 1) then
|
||||||
|
exit(True);
|
||||||
|
|
||||||
lcSetReturns := FormattingSettings.Returns;
|
lcSetReturns := FormattingSettings.Returns;
|
||||||
Assert(lcSetReturns <> nil);
|
Assert(lcSetReturns <> nil);
|
||||||
|
|
||||||
|
|||||||
@ -71,6 +71,10 @@ begin
|
|||||||
if pt.TokenType=ttReference then
|
if pt.TokenType=ttReference then
|
||||||
exit(true);
|
exit(true);
|
||||||
|
|
||||||
|
{ after record ... end align XX; }
|
||||||
|
if (pt.TokenType = ttAlign) and pt.HasParentNode(nRecordType, 1) then
|
||||||
|
exit(true);
|
||||||
|
|
||||||
// referencce to procedure/function
|
// referencce to procedure/function
|
||||||
if (pt.TokenType in [ttFunction,ttProcedure]) and (pt.PriorSolidTokenType=ttTo) then
|
if (pt.TokenType in [ttFunction,ttProcedure]) and (pt.PriorSolidTokenType=ttTo) then
|
||||||
exit(true);
|
exit(true);
|
||||||
|
|||||||
@ -316,7 +316,10 @@ begin
|
|||||||
if (lcNext <> nil) and (lcNext.TokenType = ttElse) then
|
if (lcNext <> nil) and (lcNext.TokenType = ttElse) then
|
||||||
Result := (FormattingSettings.Returns.EndElseStyle = eAlways)
|
Result := (FormattingSettings.Returns.EndElseStyle = eAlways)
|
||||||
else
|
else
|
||||||
Result := True;
|
begin
|
||||||
|
{ after record ... end align XX; }
|
||||||
|
Result := not ((lcNext <> nil) and (lcNext.TokenType = ttAlign) and lcNext.HasParentNode(nRecordType, 1));
|
||||||
|
end;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
@ -78,6 +78,10 @@ begin
|
|||||||
|
|
||||||
Result := False;
|
Result := False;
|
||||||
|
|
||||||
|
{ after record ... end align XX; }
|
||||||
|
if (pt.TokenType = ttAlign) and pt.HasParentNode(nRecordType, 1) then
|
||||||
|
exit(True);
|
||||||
|
|
||||||
if (pt.TokenType in operators) and pt.HasParentNode(nIdentifier,1) then //operator orverloading identifier;
|
if (pt.TokenType in operators) and pt.HasParentNode(nIdentifier,1) then //operator orverloading identifier;
|
||||||
Exit(False);
|
Exit(False);
|
||||||
|
|
||||||
|
|||||||
@ -78,6 +78,10 @@ begin
|
|||||||
if pt = nil then
|
if pt = nil then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
|
{ after record ... end align XX; }
|
||||||
|
if (pt.TokenType = ttAlign) and pt.HasParentNode(nRecordType, 1) then
|
||||||
|
exit(True);
|
||||||
|
|
||||||
if pt.HasParentNode(nGeneric, 1) then
|
if pt.HasParentNode(nGeneric, 1) then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user