|
@@ -196,7 +196,7 @@ type
|
|
function ParseSpecializeType(Parent: TPasElement; Const TypeName: String): TPasClassType;
|
|
function ParseSpecializeType(Parent: TPasElement; Const TypeName: String): TPasClassType;
|
|
Function ParseClassDecl(Parent: TPasElement; const AClassName: String; AObjKind: TPasObjKind; PackMode : TPackMode= pmNone): TPasType;
|
|
Function ParseClassDecl(Parent: TPasElement; const AClassName: String; AObjKind: TPasObjKind; PackMode : TPackMode= pmNone): TPasType;
|
|
Function ParseProperty(Parent : TPasElement; Const AName : String; AVisibility : TPasMemberVisibility; IsClass : Boolean) : TPasProperty;
|
|
Function ParseProperty(Parent : TPasElement; Const AName : String; AVisibility : TPasMemberVisibility; IsClass : Boolean) : TPasProperty;
|
|
- function ParseRangeType(AParent: TPasElement; Const TypeName: String): TPasRangeType;
|
|
|
|
|
|
+ function ParseRangeType(AParent: TPasElement; Const TypeName: String; Full : Boolean = True): TPasRangeType;
|
|
// Constant declarations
|
|
// Constant declarations
|
|
function ParseConstDecl(Parent: TPasElement): TPasConst;
|
|
function ParseConstDecl(Parent: TPasElement): TPasConst;
|
|
function ParseResourcestringDecl(Parent: TPasElement): TPasResString;
|
|
function ParseResourcestringDecl(Parent: TPasElement): TPasResString;
|
|
@@ -920,7 +920,7 @@ begin
|
|
tkRecord: Result := ParseRecordDecl(Parent,TypeName,PM);
|
|
tkRecord: Result := ParseRecordDecl(Parent,TypeName,PM);
|
|
else
|
|
else
|
|
UngetToken;
|
|
UngetToken;
|
|
- Result:=ParseRangeType(Parent,TypeName);
|
|
|
|
|
|
+ Result:=ParseRangeType(Parent,TypeName,Full);
|
|
end;
|
|
end;
|
|
if CH then
|
|
if CH then
|
|
CheckHint(Result,True);
|
|
CheckHint(Result,True);
|
|
@@ -1120,21 +1120,29 @@ begin
|
|
NextToken;
|
|
NextToken;
|
|
if (length(CurTokenText)>0) and (CurTokenText[1] in ['A'..'_']) then begin
|
|
if (length(CurTokenText)>0) and (CurTokenText[1] in ['A'..'_']) then begin
|
|
b:=TBinaryExpr.Create(AParent,x, DoParseExpression(AParent), eopNone);
|
|
b:=TBinaryExpr.Create(AParent,x, DoParseExpression(AParent), eopNone);
|
|
- if not Assigned(b.right) then Exit; // error
|
|
|
|
|
|
+ if not Assigned(b.right) then
|
|
|
|
+ begin
|
|
|
|
+ B.Free;
|
|
|
|
+ Exit; // error
|
|
|
|
+ end;
|
|
x:=b;
|
|
x:=b;
|
|
UngetToken;
|
|
UngetToken;
|
|
end
|
|
end
|
|
else UngetToken;
|
|
else UngetToken;
|
|
end;
|
|
end;
|
|
tkself: begin
|
|
tkself: begin
|
|
- x:=TPrimitiveExpr.Create(AParent,pekString, CurTokenText); //function(self);
|
|
|
|
|
|
+ //x:=TPrimitiveExpr.Create(AParent,pekString, CurTokenText); //function(self);
|
|
x:=TSelfExpr.Create(AParent);
|
|
x:=TSelfExpr.Create(AParent);
|
|
NextToken;
|
|
NextToken;
|
|
if CurToken = tkDot then begin // self.Write(EscapeText(AText));
|
|
if CurToken = tkDot then begin // self.Write(EscapeText(AText));
|
|
optk:=CurToken;
|
|
optk:=CurToken;
|
|
NextToken;
|
|
NextToken;
|
|
b:=TBinaryExpr.Create(AParent,x, ParseExpIdent(AParent), TokenToExprOp(optk));
|
|
b:=TBinaryExpr.Create(AParent,x, ParseExpIdent(AParent), TokenToExprOp(optk));
|
|
- if not Assigned(b.right) then Exit; // error
|
|
|
|
|
|
+ if not Assigned(b.right) then
|
|
|
|
+ begin
|
|
|
|
+ B.Free;
|
|
|
|
+ Exit; // error
|
|
|
|
+ end;
|
|
x:=b;
|
|
x:=b;
|
|
end
|
|
end
|
|
else UngetToken;
|
|
else UngetToken;
|
|
@@ -1190,7 +1198,11 @@ begin
|
|
optk:=CurToken;
|
|
optk:=CurToken;
|
|
NextToken;
|
|
NextToken;
|
|
b:=TBinaryExpr.Create(AParent,x, ParseExpIdent(AParent), TokenToExprOp(optk));
|
|
b:=TBinaryExpr.Create(AParent,x, ParseExpIdent(AParent), TokenToExprOp(optk));
|
|
- if not Assigned(b.right) then Exit; // error
|
|
|
|
|
|
+ if not Assigned(b.right) then
|
|
|
|
+ begin
|
|
|
|
+ b.free;
|
|
|
|
+ Exit; // error
|
|
|
|
+ end;
|
|
x:=b;
|
|
x:=b;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
@@ -1198,7 +1210,11 @@ begin
|
|
if CurToken = tkDotDot then begin
|
|
if CurToken = tkDotDot then begin
|
|
NextToken;
|
|
NextToken;
|
|
b:=TBinaryExpr.CreateRange(AParent,x, DoParseExpression(AParent));
|
|
b:=TBinaryExpr.CreateRange(AParent,x, DoParseExpression(AParent));
|
|
- if not Assigned(b.right) then Exit; // error
|
|
|
|
|
|
+ if not Assigned(b.right) then
|
|
|
|
+ begin
|
|
|
|
+ b.free;
|
|
|
|
+ Exit; // error
|
|
|
|
+ end;
|
|
x:=b;
|
|
x:=b;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -1313,7 +1329,11 @@ begin
|
|
if CurToken = tkBraceOpen then begin
|
|
if CurToken = tkBraceOpen then begin
|
|
NextToken;
|
|
NextToken;
|
|
x:=DoParseExpression(AParent);
|
|
x:=DoParseExpression(AParent);
|
|
- if CurToken<>tkBraceClose then Exit;
|
|
|
|
|
|
+ if CurToken<>tkBraceClose then
|
|
|
|
+ begin
|
|
|
|
+ x.free;
|
|
|
|
+ Exit;
|
|
|
|
+ end;
|
|
NextToken;
|
|
NextToken;
|
|
|
|
|
|
// for the expression like (TObject(m)).Free;
|
|
// for the expression like (TObject(m)).Free;
|
|
@@ -2058,7 +2078,7 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
// Starts after the type name
|
|
// Starts after the type name
|
|
-Function TPasParser.ParseRangeType(AParent : TPasElement; Const TypeName : String) : TPasRangeType;
|
|
|
|
|
|
+Function TPasParser.ParseRangeType(AParent : TPasElement; Const TypeName : String; Full : Boolean = True) : TPasRangeType;
|
|
|
|
|
|
Var
|
|
Var
|
|
PE : TPasExpr;
|
|
PE : TPasExpr;
|
|
@@ -2066,8 +2086,11 @@ Var
|
|
begin
|
|
begin
|
|
Result := TPasRangeType(CreateElement(TPasRangeType, TypeName, AParent));
|
|
Result := TPasRangeType(CreateElement(TPasRangeType, TypeName, AParent));
|
|
try
|
|
try
|
|
- If not (CurToken=tkEqual) then
|
|
|
|
- ParseExc(Format(SParserExpectTokenError,[TokenInfos[tkEqual]]));
|
|
|
|
|
|
+ if Full then
|
|
|
|
+ begin
|
|
|
|
+ If not (CurToken=tkEqual) then
|
|
|
|
+ ParseExc(Format(SParserExpectTokenError,[TokenInfos[tkEqual]]));
|
|
|
|
+ end;
|
|
NextToken;
|
|
NextToken;
|
|
PE:=DoParseExpression(Result,Nil);
|
|
PE:=DoParseExpression(Result,Nil);
|
|
if not ((PE is TBinaryExpr) and (TBinaryExpr(PE).Kind=pekRange)) then
|
|
if not ((PE is TBinaryExpr) and (TBinaryExpr(PE).Kind=pekRange)) then
|