|
@@ -933,6 +933,13 @@ begin
|
|
x:=DoParseExpression(AParent);
|
|
x:=DoParseExpression(AParent);
|
|
if CurToken<>tkBraceClose then Exit;
|
|
if CurToken<>tkBraceClose then Exit;
|
|
NextToken;
|
|
NextToken;
|
|
|
|
+
|
|
|
|
+ // for the expression like (TObject(m)).Free;
|
|
|
|
+ if CurToken = tkDot then begin
|
|
|
|
+ NextToken;
|
|
|
|
+ x:=TBinaryExpr.Create(AParent,x, ParseExpIdent(AParent), TokenToExprOp(tkDot));
|
|
|
|
+ end;
|
|
|
|
+
|
|
end else begin
|
|
end else begin
|
|
x:=ParseExpIdent(AParent);
|
|
x:=ParseExpIdent(AParent);
|
|
end;
|
|
end;
|
|
@@ -2669,15 +2676,16 @@ var
|
|
|
|
|
|
var
|
|
var
|
|
Condition: String;
|
|
Condition: String;
|
|
- Command: String;
|
|
|
|
StartValue: String;
|
|
StartValue: String;
|
|
VarName: String;
|
|
VarName: String;
|
|
EndValue: String;
|
|
EndValue: String;
|
|
Expr: String;
|
|
Expr: String;
|
|
SubBlock: TPasImplElement;
|
|
SubBlock: TPasImplElement;
|
|
- CmdElem: TPasImplCommand;
|
|
|
|
|
|
+ CmdElem: TPasImplElement;
|
|
TypeName: String;
|
|
TypeName: String;
|
|
ForDownTo: Boolean;
|
|
ForDownTo: Boolean;
|
|
|
|
+ left: TPasExpr;
|
|
|
|
+ right: TPasExpr;
|
|
begin
|
|
begin
|
|
NewImplElement:=nil;
|
|
NewImplElement:=nil;
|
|
CurBlock := Parent;
|
|
CurBlock := Parent;
|
|
@@ -2911,42 +2919,32 @@ begin
|
|
ParseExc(SParserSyntaxError);
|
|
ParseExc(SParserSyntaxError);
|
|
end;
|
|
end;
|
|
else
|
|
else
|
|
- UngetToken;
|
|
|
|
-
|
|
|
|
- Command:='';
|
|
|
|
-
|
|
|
|
- NextToken;
|
|
|
|
- // testing for label mark
|
|
|
|
- if CurToken=tkIdentifier then
|
|
|
|
- begin
|
|
|
|
- Command:=CurTokenText;
|
|
|
|
- NextToken;
|
|
|
|
- // testing for the goto mark
|
|
|
|
- if CurToken=tkColon then
|
|
|
|
- begin
|
|
|
|
- CurBlock.AddLabelMark(Command);
|
|
|
|
- end
|
|
|
|
- else
|
|
|
|
|
|
+ left:=DoParseExpression(nil);
|
|
|
|
+ case CurToken of
|
|
|
|
+ tkAssign:
|
|
begin
|
|
begin
|
|
- Command:='';
|
|
|
|
- UngetToken;
|
|
|
|
|
|
+ // assign statement
|
|
|
|
+ NextToken;
|
|
|
|
+ right:=ParseExpIdent(Parent);
|
|
|
|
+ CmdElem:=CurBlock.AddAssign(left, right);
|
|
UngetToken;
|
|
UngetToken;
|
|
end;
|
|
end;
|
|
- end else
|
|
|
|
|
|
+ tkColon:
|
|
|
|
+ begin
|
|
|
|
+ if not (left is TPrimitiveExpr) then
|
|
|
|
+ ParseExc(Format(SParserExpectTokenError, [TokenInfos[tkSemicolon]]));
|
|
|
|
+ // label mark. todo: check mark identifier in the list of labels
|
|
|
|
+ CmdElem:=CurBlock.AddLabelMark(TPrimitiveExpr(left).Value);
|
|
|
|
+ left.Free;
|
|
|
|
+ end
|
|
|
|
+ else
|
|
|
|
+ // simple statement (function call)
|
|
|
|
+ CmdElem:=CurBlock.AddSimple(left);
|
|
UngetToken;
|
|
UngetToken;
|
|
|
|
+ end;
|
|
|
|
|
|
-
|
|
|
|
- if Command='' then
|
|
|
|
- begin
|
|
|
|
- // parsing the assignment statement or call expression
|
|
|
|
- Command:=ParseCommand;
|
|
|
|
- //WriteLn(i,'COMMAND="',Command,'" Token=',CurTokenString);
|
|
|
|
- if Command='' then
|
|
|
|
- ParseExc(SParserSyntaxError);
|
|
|
|
- CmdElem:=CurBlock.AddCommand(Command);
|
|
|
|
|
|
+ if not (CmdElem is TPasImplLabelMark) then
|
|
if NewImplElement=nil then NewImplElement:=CmdElem;
|
|
if NewImplElement=nil then NewImplElement:=CmdElem;
|
|
- if CloseStatement(false) then break;
|
|
|
|
- end;
|
|
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|