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:
Juha 2021-10-10 21:50:12 +03:00
parent 814e4ba4e2
commit 6439e19d40
5 changed files with 39 additions and 4 deletions

View File

@ -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;

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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