Browse Source

* absolute can also take address on some platforms

git-svn-id: trunk@47495 -
michael 4 years ago
parent
commit
bd571fdd31
2 changed files with 18 additions and 2 deletions
  1. 10 2
      packages/fcl-passrc/src/pparser.pp
  2. 8 0
      packages/fcl-passrc/tests/tcvarparser.pas

+ 10 - 2
packages/fcl-passrc/src/pparser.pp

@@ -4564,8 +4564,16 @@ begin
     begin
     Result:=True;
     NextToken;
-    Location:=ReadDottedIdentifier(Parent,AbsoluteExpr,true);
-    UnGetToken;
+    if Curtoken=tkNumber then
+      begin
+      AbsoluteExpr:=CreatePrimitiveExpr(Parent,pekNumber,CurTokenString);
+      Location:=CurTokenString
+      end
+    else
+      begin
+      Location:=ReadDottedIdentifier(Parent,AbsoluteExpr,true);
+      UnGetToken;
+      end
     end
   else
     UngetToken;

+ 8 - 0
packages/fcl-passrc/tests/tcvarparser.pas

@@ -34,6 +34,7 @@ Type
     procedure TestSimpleVarInitializedDeprecated;
     procedure TestSimpleVarInitializedPlatform;
     Procedure TestSimpleVarAbsolute;
+    Procedure TestSimpleVarAbsoluteAddress;
     Procedure TestSimpleVarAbsoluteDot;
     Procedure TestSimpleVarAbsolute2Dots;
     Procedure TestVarProcedure;
@@ -193,6 +194,13 @@ begin
   AssertExpression('correct absolute location',TheVar.AbsoluteExpr,pekIdent,'v');
 end;
 
+procedure TTestVarParser.TestSimpleVarAbsoluteAddress;
+begin
+  ParseVar('q absolute $123','');
+  AssertVariableType('q');
+  AssertExpression('correct absolute location',TheVar.AbsoluteExpr,pekNumber,'$123');
+end;
+
 procedure TTestVarParser.TestSimpleVarAbsoluteDot;
 var
   B: TBinaryExpr;