mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-06 05:58:06 +02:00
JEDI Code Formatter: Support a list of used registers at the end of "asm" block. Issue #35722, patch by DomingoGP.
This commit is contained in:
parent
814e4ba4e2
commit
6439e19d40
@ -5377,9 +5377,26 @@ begin
|
||||
Recognise(ttAsm);
|
||||
while fcTokenList.FirstSolidTokenType <> ttEnd do
|
||||
RecogniseAsmStatement;
|
||||
|
||||
Recognise(ttEnd);
|
||||
|
||||
// list of used registers
|
||||
// end ['EAX','EBX','ECX']
|
||||
if fcTokenList.FirstSolidTokenType = ttOpenSquareBracket then
|
||||
begin
|
||||
PushNode(nArrayConstant);
|
||||
Recognise(ttOpenSquareBracket);
|
||||
// register list can be empty
|
||||
if fcTokenList.FirstSolidTokenType = ttQuotedLiteralString then
|
||||
begin
|
||||
Recognise(ttQuotedLiteralString);
|
||||
while (fcTokenList.FirstSolidTokenType = ttComma) do
|
||||
begin
|
||||
Recognise(ttComma);
|
||||
Recognise(ttQuotedLiteralString);
|
||||
end;
|
||||
end;
|
||||
Recognise(ttCloseSquareBracket);
|
||||
PopNode;
|
||||
end;
|
||||
PopNode;
|
||||
end;
|
||||
|
||||
|
@ -67,7 +67,12 @@ begin
|
||||
exit;
|
||||
|
||||
if pt.HasParentNode(nAsm) then
|
||||
begin
|
||||
//end registers list end ['eax', 'ebx']
|
||||
if pt.HasParentNode(nArrayConstant) then
|
||||
exit(true);
|
||||
exit;
|
||||
end;
|
||||
|
||||
{ a semicolon should have a return before it if it is the only token in the statement
|
||||
e.g.
|
||||
|
@ -86,7 +86,11 @@ begin
|
||||
|
||||
// '@@' in asm, e.g. "JE @@initTls" needs the space
|
||||
if pt.HasParentNode(nAsm) then
|
||||
exit;
|
||||
begin
|
||||
//end registers list end ['eax', 'ebx']
|
||||
if not pt.HasParentNode(nArrayConstant) then
|
||||
exit;
|
||||
end;
|
||||
|
||||
if pt.TokenType in NoSpaceAnywhere then
|
||||
begin
|
||||
|
@ -78,7 +78,11 @@ begin
|
||||
exit;
|
||||
|
||||
if pt.HasParentNode(nAsm) then
|
||||
exit;
|
||||
begin
|
||||
//end registers list end ['eax', 'ebx']
|
||||
if not pt.HasParentNode(nArrayConstant) then
|
||||
exit;
|
||||
end;
|
||||
|
||||
if pt.HasParentNode(nGeneric, 2) then
|
||||
begin
|
||||
|
@ -119,7 +119,12 @@ begin
|
||||
|
||||
{ not in Asm block }
|
||||
if pt.HasParentNode(nAsm) then
|
||||
begin
|
||||
//end registers list end ['eax', 'ebx']
|
||||
if (pt.TokenType=ttOpenSquareBracket) and pt.HasParentNode(nArrayConstant) then
|
||||
exit(true);
|
||||
exit;
|
||||
end;
|
||||
|
||||
if (pt.TokenType in AssignmentDirectives) then
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user