FROM M2Debug IMPORT Assert ;
FROM M2Quads IMPORT PushT, PopT, PushTF, PopTF, PopNothing, OperandT, PushTFA, Top, Annotate,
+ OperandTok,
PushTFtok, PopTFtok, PushTFAtok, PopTtok, PushTtok,
StartBuildInit,
EndBuildInit,
SimpleType % BuildFieldArray ; %
} "OF" % BuildNulName ; %
Type % EndBuildArray ;
+ tok := OperandTok (1) ;
PopNothing ;
- PushTtok(arrayType, tok) %
+ PushTtok (arrayType, tok) %
=:
RecordType := "RECORD" % BuildRecord %
THEN
IF isunknown
THEN
- MetaError2('attempting to declare a type {%1ad} to a type which is itself unknown {%2ad}',
+ MetaError2('attempting to declare a type {%1ad} to a type which is itself and also unknown {%2ad}',
Sym, Type)
ELSE
MetaError1('attempting to declare a type {%1ad} as itself', Sym)
PROCEDURE EndBuildArray ;
VAR
+ typetok,
+ arraytok,
+ combinedtok: CARDINAL ;
TypeSym,
- ArraySym: CARDINAL ;
-BEGIN
- PopT(TypeSym) ;
- PopT(ArraySym) ;
- Assert(IsArray(ArraySym)) ;
- PutArray(ArraySym, TypeSym) ;
- PushT(ArraySym) ;
- Annotate("%1s(%1d)||array type")
+ ArraySym : CARDINAL ;
+BEGIN
+ PopTtok (TypeSym, typetok) ;
+ PopTtok (ArraySym, arraytok) ;
+ Assert (IsArray (ArraySym)) ;
+ combinedtok := MakeVirtual2Tok (arraytok, typetok) ;
+ PutArray (ArraySym, TypeSym) ;
+ PutDeclared (combinedtok, ArraySym) ;
+ PushTtok (ArraySym, combinedtok) ;
+ Annotate ("%1s(%1d)||array type")
END EndBuildArray ;
PROCEDURE BuildFieldArray ;
VAR
+ typetok,
+ arraytok : CARDINAL ;
Subscript,
Type,
Array : CARDINAL ;
name : Name ;
BEGIN
- PopTF(Type, name) ;
- PopT(Array) ;
- Assert(IsArray(Array)) ;
- Subscript := MakeSubscript() ;
+ PopTFtok (Type, name, typetok) ;
+ PopTtok (Array, arraytok) ;
+ Assert (IsArray (Array)) ;
+ Subscript := MakeSubscript () ;
(*
We cannot Assert(IsSubrange(Type)) as the subrange type might be
declared later on in the file.
However this works to our advantage as it preserves the
actual declaration as specified by the source file.
*)
- PutSubscript(Subscript, Type) ;
- PutArraySubscript(Array, Subscript) ;
- PushT(Array) ;
- Annotate("%1s(%1d)||array type")
+ PutSubscript (Subscript, Type) ;
+ PutArraySubscript (Array, Subscript) ;
+ PushTtok (Array, arraytok) ;
+ Annotate ("%1s(%1d)||array type")
(* ; WriteString('Field Placed in Array') ; WriteLn *)
END BuildFieldArray ;
(*
- PutArray - places a type symbol into an Array.
+ PutArray - places a type symbol into an arraysym.
*)
-PROCEDURE PutArray (Sym, TypeSymbol: CARDINAL) ;
+PROCEDURE PutArray (arraysym, typesym: CARDINAL) ;
VAR
pSym: PtrToSymbol ;
BEGIN
- pSym := GetPsym(Sym) ;
+ pSym := GetPsym (arraysym) ;
WITH pSym^ DO
CASE SymbolType OF
ErrorSym: |
ArraySym: WITH Array DO
- Type := TypeSymbol (* The Array Type. ARRAY OF Type. *)
+ Type := typesym (* The ARRAY OF typesym. *)
END
ELSE
InternalError ('expecting an Array symbol')