Support for record variables being assigned to record variables
This commit is contained in:
parent
4a65df60cc
commit
ebf17764fe
|
@ -134,6 +134,7 @@ Type
|
||||||
Procedure ParseVarFile;
|
Procedure ParseVarFile;
|
||||||
Procedure ParseVarBoolean;
|
Procedure ParseVarBoolean;
|
||||||
Procedure ParseVarChar;
|
Procedure ParseVarChar;
|
||||||
|
Procedure ParseVarRecord;
|
||||||
Procedure ParseVariable (VT: TIdentTypes);
|
Procedure ParseVariable (VT: TIdentTypes);
|
||||||
Procedure ParseArray (VN: Word);
|
Procedure ParseArray (VN: Word);
|
||||||
Function ParseElement (VN: Word; TypeCheck: Boolean; VT: TIdentTypes) : TIdentTypes;
|
Function ParseElement (VN: Word; TypeCheck: Boolean; VT: TIdentTypes) : TIdentTypes;
|
||||||
|
@ -1289,6 +1290,22 @@ Begin
|
||||||
If VarData[VarNum]^.vType <> iFile Then Error (mpsTypeMismatch, '');
|
If VarData[VarNum]^.vType <> iFile Then Error (mpsTypeMismatch, '');
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
Procedure TParserEngine.ParseVarRecord;
|
||||||
|
Var
|
||||||
|
VarNum : Word;
|
||||||
|
Begin
|
||||||
|
GetIdent(True);
|
||||||
|
|
||||||
|
If UpdateInfo.ErrorType <> 0 Then Exit;
|
||||||
|
|
||||||
|
VarNum := FindVariable(IdentStr);
|
||||||
|
|
||||||
|
If VarData[VarNum]^.vType <> iRecord Then
|
||||||
|
Error (mpsTypeMismatch, '');
|
||||||
|
|
||||||
|
OutWord (VarNum);
|
||||||
|
End;
|
||||||
|
|
||||||
Procedure TParserEngine.NewBooleanCrap;
|
Procedure TParserEngine.NewBooleanCrap;
|
||||||
Var
|
Var
|
||||||
VarNum : Word;
|
VarNum : Word;
|
||||||
|
@ -1501,36 +1518,37 @@ begin
|
||||||
|
|
||||||
GetEvalIdent (VarType1);
|
GetEvalIdent (VarType1);
|
||||||
|
|
||||||
if updateinfo.errorType <> 0 then Exit;
|
If UpdateInfo.ErrorType <> 0 Then Exit;
|
||||||
|
|
||||||
if GetStr(tkw[wOpEqual], False, False) then begin OutString(Char(OpEqual)); OpType := topEqual; end else
|
If GetStr(tkw[wOpEqual], False, False) Then Begin OutString(Char(OpEqual)); OpType := topEqual; End Else
|
||||||
if GetStr(tkw[wOpNotEqual], False, False) then begin OutString(Char(OpNotEqual)); OpType := topNotEqual; end else
|
If GetStr(tkw[wOpNotEqual], False, False) Then Begin OutString(Char(OpNotEqual)); OpType := topNotEqual; End Else
|
||||||
if GetStr(tkw[wOpEqGreat], False, False) then begin OutString(Char(OpEqGreat)); OpType := topEqGreat; end else
|
If GetStr(tkw[wOpEqGreat], False, False) Then Begin OutString(Char(OpEqGreat)); OpType := topEqGreat; End Else
|
||||||
if GetStr(tkw[wOpEqLess], False, False) then begin OutString(Char(OpEqLess)); OpType := topEqLess; end else
|
If GetStr(tkw[wOpEqLess], False, False) Then Begin OutString(Char(OpEqLess)); OpType := topEqLess; End Else
|
||||||
if GetStr(tkw[wOpGreater], False, False) then begin OutString(Char(OpGreater)); OpType := topGreater; end else
|
If GetStr(tkw[wOpGreater], False, False) Then Begin OutString(Char(OpGreater)); OpType := topGreater; End Else
|
||||||
if GetStr(tkw[wOpLess], False, False) then begin OutString(Char(OpLess)); OpType := topLess; end else
|
If GetStr(tkw[wOpLess], False, False) Then Begin OutString(Char(OpLess)); OpType := topLess; End Else
|
||||||
if VarType1 <> iBool then Error(mpsExpOperator, '');
|
If VarType1 <> iBool then Error(mpsExpOperator, '');
|
||||||
|
|
||||||
if OpType <> tOpNone then begin
|
If OpType <> tOpNone then begin
|
||||||
GetEvalIdent(VarType2);
|
GetEvalIdent(VarType2);
|
||||||
|
|
||||||
if updateinfo.errorType <> 0 then Exit;
|
If UpdateInfo.ErrorType <> 0 Then Exit;
|
||||||
|
|
||||||
if ((VarType1 in vStrings) and (Not (VarType2 in vStrings))) or
|
If ((VarType1 in vStrings) and (Not (VarType2 in vStrings))) or
|
||||||
((VarType1 = iBool) and (VarType2 <> iBool)) or
|
((VarType1 = iBool) and (VarType2 <> iBool)) or
|
||||||
((VarType1 = iFile) and (VarType2 <> iFile)) or
|
((VarType1 = iFile) and (VarType2 <> iFile)) or
|
||||||
((VarType1 in vNums) and (not (VarType2 in vNums))) Then Error(mpsTypeMismatch, '');
|
((VarType1 in vNums) and (not (VarType2 in vNums))) Then
|
||||||
end;
|
Error(mpsTypeMismatch, '');
|
||||||
|
End;
|
||||||
|
|
||||||
if GetStr(tkw[wAnd], False, False) then begin
|
If GetStr(tkw[wAnd], False, False) Then Begin
|
||||||
OutString(Char(opAnd));
|
OutString(Char(opAnd));
|
||||||
ParseVarBoolean;
|
ParseVarBoolean;
|
||||||
end else
|
End Else
|
||||||
if GetStr(tkw[wOr], False, False) then begin
|
If GetStr(tkw[wOr], False, False) Then Begin
|
||||||
OutString(Char(opOr));
|
OutString(Char(opOr));
|
||||||
ParseVarBoolean;
|
ParseVarBoolean;
|
||||||
end;
|
End;
|
||||||
end;
|
End;
|
||||||
|
|
||||||
Procedure TParserEngine.ParseVariable (VT: TIdentTypes);
|
Procedure TParserEngine.ParseVariable (VT: TIdentTypes);
|
||||||
Begin
|
Begin
|
||||||
|
@ -1538,7 +1556,10 @@ Begin
|
||||||
If VT = iString Then ParseVarString Else
|
If VT = iString Then ParseVarString Else
|
||||||
If VT = iChar Then ParseVarChar Else
|
If VT = iChar Then ParseVarChar Else
|
||||||
If VT = iBool Then ParseVarBoolean Else
|
If VT = iBool Then ParseVarBoolean Else
|
||||||
|
If VT = iRecord Then ParseVarRecord Else
|
||||||
If VT = iFile Then Error(mpsInStatement,'');
|
If VT = iFile Then Error(mpsInStatement,'');
|
||||||
|
|
||||||
|
// pointer
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function TParserEngine.GetDataSize (Info: TParserVarInfoRec) : LongInt;
|
Function TParserEngine.GetDataSize (Info: TParserVarInfoRec) : LongInt;
|
||||||
|
@ -2559,7 +2580,6 @@ Begin
|
||||||
|
|
||||||
VT := ParseElement (VarNum, False, iNone);
|
VT := ParseElement (VarNum, False, iNone);
|
||||||
|
|
||||||
//will need to pull vartype from parse array here
|
|
||||||
GetChar;
|
GetChar;
|
||||||
|
|
||||||
// prob shoud be iString check here. also need to
|
// prob shoud be iString check here. also need to
|
||||||
|
|
|
@ -958,6 +958,11 @@ Begin
|
||||||
iCardinal : Cardinal(GetDataPtr(VarNum, ArrayData, RecInfo)^) := Trunc(EvaluateNumber);
|
iCardinal : Cardinal(GetDataPtr(VarNum, ArrayData, RecInfo)^) := Trunc(EvaluateNumber);
|
||||||
iReal : Real(GetDataPtr(VarNum, ArrayData, RecInfo)^) := EvaluateNumber;
|
iReal : Real(GetDataPtr(VarNum, ArrayData, RecInfo)^) := EvaluateNumber;
|
||||||
iBool : ByteBool(GetDataPtr(VarNum, ArrayData, RecInfo)^) := EvaluateBoolean;
|
iBool : ByteBool(GetDataPtr(VarNum, ArrayData, RecInfo)^) := EvaluateBoolean;
|
||||||
|
iRecord : Begin
|
||||||
|
NextWord;
|
||||||
|
|
||||||
|
Move (VarData[W]^.Data^, GetDataPtr(VarNum, ArrayData, RecInfo)^, VarData[W]^.DataSize);
|
||||||
|
End;
|
||||||
End;
|
End;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue