|
@@ -101,6 +101,7 @@ const
|
|
nParserOnlyOneVariableCanBeAbsolute = 2055;
|
|
nParserOnlyOneVariableCanBeAbsolute = 2055;
|
|
nParserXNotAllowedInY = 2056;
|
|
nParserXNotAllowedInY = 2056;
|
|
nFileSystemsNotSupported = 2057;
|
|
nFileSystemsNotSupported = 2057;
|
|
|
|
+ nInvalidMessageType = 2058;
|
|
|
|
|
|
// resourcestring patterns of messages
|
|
// resourcestring patterns of messages
|
|
resourcestring
|
|
resourcestring
|
|
@@ -161,6 +162,7 @@ resourcestring
|
|
SParserOnlyOneVariableCanBeAbsolute = 'Only one variable can be absolute';
|
|
SParserOnlyOneVariableCanBeAbsolute = 'Only one variable can be absolute';
|
|
SParserXNotAllowedInY = '%s is not allowed in %s';
|
|
SParserXNotAllowedInY = '%s is not allowed in %s';
|
|
SErrFileSystemNotSupported = 'No support for filesystems enabled';
|
|
SErrFileSystemNotSupported = 'No support for filesystems enabled';
|
|
|
|
+ SErrInvalidMessageType = 'Invalid message type: string or integer expression expected';
|
|
|
|
|
|
type
|
|
type
|
|
TPasScopeType = (
|
|
TPasScopeType = (
|
|
@@ -1356,11 +1358,9 @@ begin
|
|
if Parent is TPasClassType then
|
|
if Parent is TPasClassType then
|
|
begin
|
|
begin
|
|
if PM in [pmPublic,pmForward] then exit(false);
|
|
if PM in [pmPublic,pmForward] then exit(false);
|
|
- case TPasClassType(Parent).ObjKind of
|
|
|
|
- okInterface,okDispInterface:
|
|
|
|
- if not (PM in [pmOverload, pmMessage,
|
|
|
|
- pmDispId,pmNoReturn,pmFar,pmFinal]) then exit(false);
|
|
|
|
- end;
|
|
|
|
|
|
+ if TPasClassType(Parent).ObjKind in [okInterface,okDispInterface] then
|
|
|
|
+ if not (PM in [pmOverload, pmMessage, pmDispId,pmNoReturn,pmFar,pmFinal]) then
|
|
|
|
+ exit(false);
|
|
exit;
|
|
exit;
|
|
end
|
|
end
|
|
else if Parent is TPasRecordType then
|
|
else if Parent is TPasRecordType then
|
|
@@ -2018,6 +2018,7 @@ begin
|
|
tkprocedure : Result:=ParseProcedureType(Parent,NamePos,TypeName,ptProcedure);
|
|
tkprocedure : Result:=ParseProcedureType(Parent,NamePos,TypeName,ptProcedure);
|
|
tkfunction : Result:=ParseProcedureType(Parent,NamePos,TypeName,ptFunction);
|
|
tkfunction : Result:=ParseProcedureType(Parent,NamePos,TypeName,ptFunction);
|
|
else
|
|
else
|
|
|
|
+ result:=Nil; // Fool compiler
|
|
ParseExcTokenError('procedure or function');
|
|
ParseExcTokenError('procedure or function');
|
|
end;
|
|
end;
|
|
Result.IsReferenceTo:=True;
|
|
Result.IsReferenceTo:=True;
|
|
@@ -2101,6 +2102,7 @@ function TPasParser.ExprToText(Expr: TPasExpr): String;
|
|
var
|
|
var
|
|
C: TClass;
|
|
C: TClass;
|
|
begin
|
|
begin
|
|
|
|
+ Result:='';
|
|
C:=Expr.ClassType;
|
|
C:=Expr.ClassType;
|
|
if C=TPrimitiveExpr then
|
|
if C=TPrimitiveExpr then
|
|
Result:=TPrimitiveExpr(Expr).Value
|
|
Result:=TPrimitiveExpr(Expr).Value
|
|
@@ -2286,6 +2288,7 @@ begin
|
|
tkDot : Result:=eopSubIdent;
|
|
tkDot : Result:=eopSubIdent;
|
|
tkCaret : Result:=eopDeref;
|
|
tkCaret : Result:=eopDeref;
|
|
else
|
|
else
|
|
|
|
+ result:=eopAdd; // Fool compiler
|
|
ParseExc(nParserNotAnOperand,SParserNotAnOperand,[AToken,TokenInfos[AToken]]);
|
|
ParseExc(nParserNotAnOperand,SParserNotAnOperand,[AToken,TokenInfos[AToken]]);
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
@@ -2961,6 +2964,7 @@ var
|
|
OldMember: TPasElement;
|
|
OldMember: TPasElement;
|
|
OverloadedProc: TPasOverloadedProc;
|
|
OverloadedProc: TPasOverloadedProc;
|
|
begin
|
|
begin
|
|
|
|
+ OldMember:=nil;
|
|
With Decs do
|
|
With Decs do
|
|
begin
|
|
begin
|
|
if not (po_nooverloadedprocs in Options) then
|
|
if not (po_nooverloadedprocs in Options) then
|
|
@@ -3417,6 +3421,7 @@ end;
|
|
function TPasParser.GetProcTypeFromToken(tk: TToken; IsClass: Boolean
|
|
function TPasParser.GetProcTypeFromToken(tk: TToken; IsClass: Boolean
|
|
): TProcType;
|
|
): TProcType;
|
|
begin
|
|
begin
|
|
|
|
+ Result:=ptProcedure;
|
|
Case tk of
|
|
Case tk of
|
|
tkProcedure :
|
|
tkProcedure :
|
|
if IsClass then
|
|
if IsClass then
|
|
@@ -4380,6 +4385,8 @@ function TPasParser.ParseGenericTypeDecl(Parent: TPasElement;
|
|
ProcTypeEl: TPasProcedureType;
|
|
ProcTypeEl: TPasProcedureType;
|
|
ProcType: TProcType;
|
|
ProcType: TProcType;
|
|
begin
|
|
begin
|
|
|
|
+ ProcTypeEl:=Nil;
|
|
|
|
+ ProcType:=ptProcedure;
|
|
case CurToken of
|
|
case CurToken of
|
|
tkFunction:
|
|
tkFunction:
|
|
begin
|
|
begin
|
|
@@ -5103,8 +5110,12 @@ begin
|
|
begin
|
|
begin
|
|
TPasProcedure(Parent).MessageName:=TPrimitiveExpr(E).Value;
|
|
TPasProcedure(Parent).MessageName:=TPrimitiveExpr(E).Value;
|
|
case E.Kind of
|
|
case E.Kind of
|
|
- pekNumber, pekUnary: TPasProcedure(Parent).Messagetype:=pmtInteger;
|
|
|
|
- pekString: TPasProcedure(Parent).Messagetype:=pmtString;
|
|
|
|
|
|
+ pekNumber, pekUnary:
|
|
|
|
+ TPasProcedure(Parent).Messagetype:=pmtInteger;
|
|
|
|
+ pekString:
|
|
|
|
+ TPasProcedure(Parent).Messagetype:=pmtString;
|
|
|
|
+ else
|
|
|
|
+ ParseExc(nInvalidMessageType,SErrInvalidMessageType);
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
if CurToken<>tkSemicolon then
|
|
if CurToken<>tkSemicolon then
|
|
@@ -5117,6 +5128,8 @@ begin
|
|
if CurToken<>tkSemicolon then
|
|
if CurToken<>tkSemicolon then
|
|
UngetToken;
|
|
UngetToken;
|
|
end;
|
|
end;
|
|
|
|
+ else
|
|
|
|
+ // Do nothing, satisfy compiler
|
|
end; // Case
|
|
end; // Case
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -5245,6 +5258,7 @@ begin
|
|
or (CurModule is TPasProgram))
|
|
or (CurModule is TPasProgram))
|
|
then
|
|
then
|
|
begin
|
|
begin
|
|
|
|
+ OK:=False;
|
|
if Assigned(CurModule.InterfaceSection) then
|
|
if Assigned(CurModule.InterfaceSection) then
|
|
OK:=FindInSection(Parent.Name,CurModule.InterfaceSection)
|
|
OK:=FindInSection(Parent.Name,CurModule.InterfaceSection)
|
|
else if (CurModule is TPasProgram) and Assigned(TPasProgram(CurModule).ProgramSection) then
|
|
else if (CurModule is TPasProgram) and Assigned(TPasProgram(CurModule).ProgramSection) then
|
|
@@ -5279,6 +5293,8 @@ begin
|
|
ParseExc(nParserExpectedColonID,SParserExpectedColonID);
|
|
ParseExc(nParserExpectedColonID,SParserExpectedColonID);
|
|
ResultEl.ResultType := ParseType(ResultEl,CurSourcePos);
|
|
ResultEl.ResultType := ParseType(ResultEl,CurSourcePos);
|
|
end;
|
|
end;
|
|
|
|
+ else
|
|
|
|
+ resultEl:=Nil;
|
|
end;
|
|
end;
|
|
if OfObjectPossible then
|
|
if OfObjectPossible then
|
|
begin
|
|
begin
|
|
@@ -5502,6 +5518,7 @@ function TPasParser.ParseProperty(Parent: TPasElement; const AName: String;
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
Result := Result + '[';
|
|
Result := Result + '[';
|
|
|
|
+ Param:=Nil;
|
|
Params:=TParamsExpr(CreateElement(TParamsExpr,'',aParent));
|
|
Params:=TParamsExpr(CreateElement(TParamsExpr,'',aParent));
|
|
Params.Kind:=pekArrayParams;
|
|
Params.Kind:=pekArrayParams;
|
|
Params.Value:=Expr;
|
|
Params.Value:=Expr;
|
|
@@ -5844,9 +5861,8 @@ var
|
|
if (CurBlock.Elements.Count=0) then
|
|
if (CurBlock.Elements.Count=0) then
|
|
exit; // at start of block
|
|
exit; // at start of block
|
|
t:=GetPrevToken;
|
|
t:=GetPrevToken;
|
|
- case t of
|
|
|
|
- tkSemicolon,tkColon,tkElse,tkotherwise: exit;
|
|
|
|
- end;
|
|
|
|
|
|
+ if t in [tkSemicolon,tkColon,tkElse,tkotherwise] then
|
|
|
|
+ exit;
|
|
{$IFDEF VerbosePasParser}
|
|
{$IFDEF VerbosePasParser}
|
|
writeln('TPasParser.ParseStatement.CheckSemicolon Prev=',GetPrevToken,' Cur=',CurToken,' ',CurBlock.ClassName,' ',CurBlock.Elements.Count,' ',TObject(CurBlock.Elements[0]).ClassName);
|
|
writeln('TPasParser.ParseStatement.CheckSemicolon Prev=',GetPrevToken,' Cur=',CurToken,' ',CurBlock.ClassName,' ',CurBlock.Elements.Count,' ',TObject(CurBlock.Elements[0]).ClassName);
|
|
{$ENDIF}
|
|
{$ENDIF}
|
|
@@ -6393,7 +6409,8 @@ var
|
|
begin
|
|
begin
|
|
Labels:=TPasLabels(CreateElement(TPasLabels, '', AParent));
|
|
Labels:=TPasLabels(CreateElement(TPasLabels, '', AParent));
|
|
repeat
|
|
repeat
|
|
- Labels.Labels.Add(ExpectIdentifier);
|
|
|
|
|
|
+ expectTokens([tkIdentifier,tkNumber]);
|
|
|
|
+ Labels.Labels.Add(CurTokenString);
|
|
NextToken;
|
|
NextToken;
|
|
if not (CurToken in [tkSemicolon, tkComma]) then
|
|
if not (CurToken in [tkSemicolon, tkComma]) then
|
|
ParseExcTokenError(TokenInfos[tkSemicolon]);
|
|
ParseExcTokenError(TokenInfos[tkSemicolon]);
|
|
@@ -6404,6 +6421,7 @@ end;
|
|
function TPasParser.GetProcedureClass(ProcType: TProcType): TPTreeElement;
|
|
function TPasParser.GetProcedureClass(ProcType: TProcType): TPTreeElement;
|
|
|
|
|
|
begin
|
|
begin
|
|
|
|
+ Result:=Nil;
|
|
Case ProcType of
|
|
Case ProcType of
|
|
ptFunction : Result:=TPasFunction;
|
|
ptFunction : Result:=TPasFunction;
|
|
ptClassFunction : Result:=TPasClassFunction;
|
|
ptClassFunction : Result:=TPasClassFunction;
|
|
@@ -6621,6 +6639,7 @@ begin
|
|
Case OperatorType of
|
|
Case OperatorType of
|
|
otPositive : OperatorType:=otPlus;
|
|
otPositive : OperatorType:=otPlus;
|
|
otNegative : OperatorType:=otMinus;
|
|
otNegative : OperatorType:=otMinus;
|
|
|
|
+ else
|
|
end;
|
|
end;
|
|
Name:=OperatorNames[OperatorType];
|
|
Name:=OperatorNames[OperatorType];
|
|
TPasOperator(Result).CorrectName;
|
|
TPasOperator(Result).CorrectName;
|
|
@@ -7033,6 +7052,7 @@ Var
|
|
T : TPasType;
|
|
T : TPasType;
|
|
Done : Boolean;
|
|
Done : Boolean;
|
|
begin
|
|
begin
|
|
|
|
+ Done:=False;
|
|
//Writeln('Parsing local types');
|
|
//Writeln('Parsing local types');
|
|
while (CurToken=tkSquaredBraceOpen)
|
|
while (CurToken=tkSquaredBraceOpen)
|
|
and (msPrefixedAttributes in CurrentModeswitches) do
|
|
and (msPrefixedAttributes in CurrentModeswitches) do
|