Browse Source

m68k: fixed parsing of absolute addresses in the assembler reader

git-svn-id: trunk@47418 -
Károly Balogh 4 years ago
parent
commit
a82a587a1b
1 changed files with 11 additions and 4 deletions
  1. 11 4
      compiler/m68k/ra68kmot.pas

+ 11 - 4
compiler/m68k/ra68kmot.pas

@@ -1148,10 +1148,17 @@ const
             end;
             end;
         else
         else
           begin
           begin
+            if actasmtoken in [AS_COMMA,AS_SEPARATOR] then
+              begin
+                { no longer in an expression }
+                if not ErrorFlag then
+                  BuildRefExpression := CalculateExpression(expr);
+                exit;
+              end;
+
             { write error only once. }
             { write error only once. }
             if not errorflag then
             if not errorflag then
               Message(asmr_e_invalid_constant_expression);
               Message(asmr_e_invalid_constant_expression);
-            if actasmtoken in [AS_COMMA,AS_SEPARATOR] then exit;
             { consume tokens until we find COMMA or SEPARATOR }
             { consume tokens until we find COMMA or SEPARATOR }
             errorflag := true;
             errorflag := true;
         end;
         end;
@@ -1421,7 +1428,7 @@ const
                          Message(asmr_e_invalid_operand_type);
                          Message(asmr_e_invalid_operand_type);
                       { identifiers are handled by BuildExpression }
                       { identifiers are handled by BuildExpression }
                       oper.opr.typ := OPR_CONSTANT;
                       oper.opr.typ := OPR_CONSTANT;
-		      l:=BuildExpression(true,@tempstr);
+                      l:=BuildExpression(true,@tempstr);
                       oper.opr.val :=aint(l);
                       oper.opr.val :=aint(l);
                       if tempstr<>'' then
                       if tempstr<>'' then
                         begin
                         begin
@@ -1432,13 +1439,13 @@ const
                         end;
                         end;
                  end;
                  end;
    { // Constant memory offset .              // }
    { // Constant memory offset .              // }
-   { // This must absolutely be followed by ( // }
      AS_HEXNUM,AS_INTNUM,
      AS_HEXNUM,AS_INTNUM,
      AS_BINNUM,AS_OCTALNUM,AS_PLUS:
      AS_BINNUM,AS_OCTALNUM,AS_PLUS:
                    begin
                    begin
                       Oper.InitRef;
                       Oper.InitRef;
                       oper.opr.ref.offset:=BuildRefExpression;
                       oper.opr.ref.offset:=BuildRefExpression;
-                      BuildReference(oper);
+                      if actasmtoken = AS_LPAREN then
+                        BuildReference(oper);
                    end;
                    end;
    { // A constant expression, or a Variable ref. // }
    { // A constant expression, or a Variable ref. // }
      AS_ID:  begin
      AS_ID:  begin