|
@@ -1899,23 +1899,22 @@ var
|
|
Last,func, Expr: TPasExpr;
|
|
Last,func, Expr: TPasExpr;
|
|
prm : TParamsExpr;
|
|
prm : TParamsExpr;
|
|
b : TBinaryExpr;
|
|
b : TBinaryExpr;
|
|
- optk : TToken;
|
|
|
|
ok: Boolean;
|
|
ok: Boolean;
|
|
|
|
|
|
begin
|
|
begin
|
|
Result:=nil;
|
|
Result:=nil;
|
|
case CurToken of
|
|
case CurToken of
|
|
tkString: Last:=CreatePrimitiveExpr(AParent,pekString,CurTokenString);
|
|
tkString: Last:=CreatePrimitiveExpr(AParent,pekString,CurTokenString);
|
|
- tkChar: Last:=CreatePrimitiveExpr(AParent,pekString, CurTokenText);
|
|
|
|
- tkNumber: Last:=CreatePrimitiveExpr(AParent,pekNumber, CurTokenString);
|
|
|
|
|
|
+ tkChar: Last:=CreatePrimitiveExpr(AParent,pekString,CurTokenText);
|
|
|
|
+ tkNumber: Last:=CreatePrimitiveExpr(AParent,pekNumber,CurTokenString);
|
|
tkIdentifier:
|
|
tkIdentifier:
|
|
begin
|
|
begin
|
|
if CompareText(CurTokenText,'self')=0 then
|
|
if CompareText(CurTokenText,'self')=0 then
|
|
begin
|
|
begin
|
|
Last:=CreateSelfExpr(AParent);
|
|
Last:=CreateSelfExpr(AParent);
|
|
- HandleSelf(Last)
|
|
|
|
|
|
+ HandleSelf(Last);
|
|
end
|
|
end
|
|
- Else
|
|
|
|
|
|
+ else
|
|
Last:=CreatePrimitiveExpr(AParent,pekIdent, CurTokenText)
|
|
Last:=CreatePrimitiveExpr(AParent,pekIdent, CurTokenText)
|
|
end;
|
|
end;
|
|
tkfalse, tktrue: Last:=CreateBoolConstExpr(Aparent,pekBoolConst, CurToken=tktrue);
|
|
tkfalse, tktrue: Last:=CreateBoolConstExpr(Aparent,pekBoolConst, CurToken=tktrue);
|
|
@@ -1978,59 +1977,49 @@ begin
|
|
try
|
|
try
|
|
if Last.Kind in [pekIdent,pekSelf,pekNil] then
|
|
if Last.Kind in [pekIdent,pekSelf,pekNil] then
|
|
begin
|
|
begin
|
|
- while CurToken in [tkDot] do
|
|
|
|
- begin
|
|
|
|
- NextToken;
|
|
|
|
- if CurToken in [tkIdentifier,tktrue,tkfalse] then // true and false are also identifiers
|
|
|
|
|
|
+ repeat
|
|
|
|
+ case CurToken of
|
|
|
|
+ tkDot:
|
|
begin
|
|
begin
|
|
- expr:=CreatePrimitiveExpr(AParent,pekIdent,CurTokenString);
|
|
|
|
- AddToBinaryExprChain(Result,expr,eopSubIdent);
|
|
|
|
- func:=expr;
|
|
|
|
NextToken;
|
|
NextToken;
|
|
- end
|
|
|
|
- else
|
|
|
|
- begin
|
|
|
|
- UngetToken;
|
|
|
|
- ParseExcExpectedIdentifier;
|
|
|
|
- end;
|
|
|
|
- end;
|
|
|
|
- repeat
|
|
|
|
- case CurToken of
|
|
|
|
- tkBraceOpen,tkSquaredBraceOpen:
|
|
|
|
|
|
+ if CurToken in [tkIdentifier,tktrue,tkfalse,tkself] then // true and false are also identifiers
|
|
begin
|
|
begin
|
|
- if CurToken=tkBraceOpen then
|
|
|
|
- prm:=ParseParams(AParent,pekFuncParams,isWriteOrStr(func))
|
|
|
|
- else
|
|
|
|
- prm:=ParseParams(AParent,pekArrayParams);
|
|
|
|
- if not Assigned(prm) then Exit;
|
|
|
|
- AddParamsToBinaryExprChain(Result,prm);
|
|
|
|
- end;
|
|
|
|
- tkCaret:
|
|
|
|
- begin
|
|
|
|
- Result:=CreateUnaryExpr(AParent,Result,TokenToExprOp(CurToken));
|
|
|
|
|
|
+ expr:=CreatePrimitiveExpr(AParent,pekIdent,CurTokenString);
|
|
|
|
+ AddToBinaryExprChain(Result,expr,eopSubIdent);
|
|
|
|
+ func:=expr;
|
|
NextToken;
|
|
NextToken;
|
|
|
|
+ end
|
|
|
|
+ else
|
|
|
|
+ begin
|
|
|
|
+ UngetToken;
|
|
|
|
+ ParseExcExpectedIdentifier;
|
|
end;
|
|
end;
|
|
|
|
+ end;
|
|
|
|
+ tkBraceOpen,tkSquaredBraceOpen:
|
|
|
|
+ begin
|
|
|
|
+ if CurToken=tkBraceOpen then
|
|
|
|
+ prm:=ParseParams(AParent,pekFuncParams,isWriteOrStr(func))
|
|
else
|
|
else
|
|
- break;
|
|
|
|
|
|
+ prm:=ParseParams(AParent,pekArrayParams);
|
|
|
|
+ if not Assigned(prm) then Exit;
|
|
|
|
+ AddParamsToBinaryExprChain(Result,prm);
|
|
end;
|
|
end;
|
|
- until false;
|
|
|
|
- // Needed for TSDOBaseDataObjectClass(Self.ClassType).Create
|
|
|
|
- if CurToken in [tkDot,tkas] then
|
|
|
|
- begin
|
|
|
|
- optk:=CurToken;
|
|
|
|
- NextToken;
|
|
|
|
- Expr:=ParseExpIdent(AParent);
|
|
|
|
- if Expr=nil then
|
|
|
|
- ParseExcExpectedIdentifier;
|
|
|
|
- if optk=tkDot then
|
|
|
|
- AddToBinaryExprChain(Result,Expr,TokenToExprOp(optk))
|
|
|
|
- else
|
|
|
|
|
|
+ tkCaret:
|
|
begin
|
|
begin
|
|
- // a as b
|
|
|
|
- Result:=CreateBinaryExpr(AParent,Result,Expr,TokenToExprOp(tkas));
|
|
|
|
|
|
+ Result:=CreateUnaryExpr(AParent,Result,TokenToExprOp(CurToken));
|
|
|
|
+ NextToken;
|
|
end;
|
|
end;
|
|
|
|
+ {tkLessThan:
|
|
|
|
+ begin
|
|
|
|
+ // could be an inline specialization (e.g. A<T>)
|
|
|
|
+ scanner.SetForceCaret();
|
|
|
|
+ end}
|
|
|
|
+ else
|
|
|
|
+ break;
|
|
|
|
+ end;
|
|
|
|
+ until false;
|
|
|
|
+ // Needed for TSDOBaseDataObjectClass(Self.ClassType).Create
|
|
end;
|
|
end;
|
|
- end;
|
|
|
|
ok:=true;
|
|
ok:=true;
|
|
finally
|
|
finally
|
|
if not ok then
|
|
if not ok then
|