From 506d5fe30e06010ba600444972d257ed017c2fcc Mon Sep 17 00:00:00 2001 From: nickysn Date: Tue, 20 Feb 2018 17:18:09 +0000 Subject: [PATCH] + support bracketless references in the x86 intel syntax; ugly, but TP7 (and perhaps also Delphi, TASM and MASM)-compatible git-svn-id: trunk@38296 - --- .gitattributes | 1 + compiler/x86/rax86int.pas | 24 +++++++++++++++++++++--- tests/test/tasm22.pp | 18 ++++++++++++++++++ 3 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 tests/test/tasm22.pp diff --git a/.gitattributes b/.gitattributes index 4881c76703..7741c670b1 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/compiler/x86/rax86int.pas b/compiler/x86/rax86int.pas index 81c3e75c0b..0caa92ebba 100644 --- a/compiler/x86/rax86int.pas +++ b/compiler/x86/rax86int.pas @@ -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); diff --git a/tests/test/tasm22.pp b/tests/test/tasm22.pp new file mode 100644 index 0000000000..5c271a7cce --- /dev/null +++ b/tests/test/tasm22.pp @@ -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.