+ support bracketless references in the x86 intel syntax; ugly, but TP7 (and

perhaps also Delphi, TASM and MASM)-compatible

git-svn-id: trunk@38296 -
This commit is contained in:
nickysn 2018-02-20 17:18:09 +00:00
parent 5f7ad0ecf0
commit 506d5fe30e
3 changed files with 40 additions and 3 deletions

1
.gitattributes vendored
View File

@ -12518,6 +12518,7 @@ tests/test/tasm20.pp svneol=native#text/plain
tests/test/tasm21.pp svneol=native#text/plain
tests/test/tasm21a.pp svneol=native#text/plain
tests/test/tasm21b.pp svneol=native#text/plain
tests/test/tasm22.pp svneol=native#text/plain
tests/test/tasm2a.pp svneol=native#text/plain
tests/test/tasm3.pp svneol=native#text/plain
tests/test/tasm4.pp svneol=native#text/plain

View File

@ -1240,13 +1240,19 @@ Unit Rax86int;
code : integer;
hreg : tregister;
GotStar,GotOffset,HadVar,
GotPlus,Negative : boolean;
GotPlus,Negative,BracketlessReference : boolean;
hl : tasmlabel;
isseg: boolean;
is_farproc_entry,hasofs,
hastypecast: boolean;
Begin
Consume(AS_LBRACKET);
if actasmtoken=AS_LBRACKET then
begin
Consume(AS_LBRACKET);
BracketlessReference:=false;
end
else
BracketlessReference:=true;
if not(oper.opr.typ in [OPR_LOCAL,OPR_REFERENCE]) then
oper.InitRef;
GotStar:=false;
@ -1636,12 +1642,24 @@ Unit Rax86int;
AS_RBRACKET :
begin
if GotPlus or GotStar then
if GotPlus or GotStar or BracketlessReference then
Message(asmr_e_invalid_reference_syntax);
Consume(AS_RBRACKET);
break;
end;
AS_SEPARATOR,
AS_END,
AS_COMMA:
begin
if not BracketlessReference then
begin
Message(asmr_e_invalid_reference_syntax);
RecoverConsume(true);
end;
break;
end;
else
Begin
Message(asmr_e_invalid_reference_syntax);

18
tests/test/tasm22.pp Normal file
View File

@ -0,0 +1,18 @@
{ %CPU=i8086 }
{$IFDEF FPC}
{$MODE TP}
{$ENDIF}
program tasm22;
var
p: pointer;
procedure t; assembler;
asm
call dword ptr es:p
end;
begin
end.