* Fixed case of range starting with negative identifier

git-svn-id: trunk@20865 -
This commit is contained in:
michael 2012-04-14 14:37:12 +00:00
parent 9e5081cd90
commit f993b813b1

View File

@ -1252,7 +1252,7 @@ var
const const
PrefixSym = [tkPlus, tkMinus, tknot, tkAt]; // + - not @ PrefixSym = [tkPlus, tkMinus, tknot, tkAt]; // + - not @
BinaryOP = [tkMul, tkDivision, tkdiv, tkmod, BinaryOP = [tkMul, tkDivision, tkdiv, tkmod, tkDotDot,
tkand, tkShl,tkShr, tkas, tkPower, tkand, tkShl,tkShr, tkas, tkPower,
tkPlus, tkMinus, tkor, tkxor, tkSymmetricalDifference, tkPlus, tkMinus, tkor, tkxor, tkSymmetricalDifference,
tkEqual, tkNotEqual, tkLessThan, tkLessEqualThan, tkEqual, tkNotEqual, tkLessThan, tkLessEqualThan,
@ -1304,7 +1304,6 @@ begin
repeat repeat
NotBinary:=True; NotBinary:=True;
pcount:=0; pcount:=0;
if not Assigned(InitExpr) then if not Assigned(InitExpr) then
begin begin
// the first part of the expression has been parsed externally. // the first part of the expression has been parsed externally.
@ -1348,9 +1347,17 @@ begin
if not Assigned(x) then Exit; if not Assigned(x) then Exit;
expstack.Add(x); expstack.Add(x);
for i:=1 to pcount do begin for i:=1 to pcount do begin
tempop:=PopOper; tempop:=PopOper;
expstack.Add( TUnaryExpr.Create(AParent, PopExp, TokenToExprOp(tempop) )); x:=popexp;
if (tempop=tkMinus) and (X.Kind=pekRange) then
begin
TBinaryExpr(x).Left:=TUnaryExpr.Create(x, TBinaryExpr(X).left, eopSubtract);
expstack.Add(x);
end
else
expstack.Add( TUnaryExpr.Create(AParent, PopExp, TokenToExprOp(tempop) ));
end; end;
end else end else
@ -1358,7 +1365,6 @@ begin
expstack.Add(InitExpr); expstack.Add(InitExpr);
InitExpr:=nil; InitExpr:=nil;
end; end;
if (CurToken in BinaryOP) then begin if (CurToken in BinaryOP) then begin
// Adjusting order of the operations // Adjusting order of the operations
NotBinary:=False; NotBinary:=False;