def qualident(): global sym obj = ORB.thisObj() sym = ORS.Get() if obj == None: ORS.Mark("undef") obj = dummy if (sym == ORS.period) and (obj.class_ == ORB.Mod): sym = ORS.Get() if sym == ORS.ident: obj = ORB.thisimport(obj) sym = ORS.Get() if obj == None: ORS.Mark("undef") obj = dummy else: ORS.Mark("identifier expected") obj = dummy return obj
def qualident(): global sym obj = ORB.thisObj() sym = ORS.Get(); if obj == None: ORS.Mark("undef") obj = dummy if (sym == ORS.period) and (obj.class_ == ORB.Mod): sym = ORS.Get() if sym == ORS.ident: obj = ORB.thisimport(obj) sym = ORS.Get() if obj == None: ORS.Mark("undef") obj = dummy else: ORS.Mark("identifier expected") obj = dummy return obj
def Type(type_): global sym, pbsList # VAR dmy: LONGINT; obj: ORB.Object; ptbase: PtrBase; type_ = copy(ORB.intType) # (*sync*) obj = ORB.Object() if (sym != ORS.ident) and (sym < ORS.array): ORS.Mark("not a type_") while True: sym = ORS.Get() if (sym == ORS.ident) or (sym >= ORS.array): break if sym == ORS.ident: obj = qualident() if obj.class_ == ORB.Typ: if (obj.type_ != None) and (obj.type_.form != ORB.NoTyp): type_ = obj.type_ else: ORS.Mark("not a type_ or undefined") elif sym == ORS.array: sym = ORS.Get() type_ = ArrayType(type_) elif sym == ORS.record: sym = ORS.Get() type_ = RecordType(type_) Check(ORS.end, "no END") elif sym == ORS.pointer: sym = ORS.Get() Check(ORS.to, "no TO") type_ = ORB.Type() type_.form = ORB.Pointer type_.size = ORG.WordSize type_.base = ORB.intType if sym == ORS.ident: obj = ORB.thisObj() sym = ORS.Get() if obj != None: if (obj.class_ == ORB.Typ) and (obj.type_.form in {ORB.Record, ORB.NoTyp}): type_.base = obj.type_ else: ORS.Mark("no valid base type_") ptbase = PtrBase() ptbase.name = ORS.CopyId() ptbase.type_ = type_ ptbase.next = pbsList pbsList = ptbase else: type_.base = Type(type_.base) if type_.base.form != ORB.Record: ORS.Mark("must point to record") elif sym == ORS.procedure: sym = ORS.Get() ORB.OpenScope() type_ = ORB.Type() type_.form = ORB.Proc type_.size = ORG.WordSize ProcedureType(type_, 0) type_.dsc = ORB.topScope.next ORB.CloseScope() else: ORS.Mark("illegal type_") return type_
def Type(type_): global sym, pbsList # VAR dmy: LONGINT; obj: ORB.Object; ptbase: PtrBase; type_ = copy(ORB.intType) # (*sync*) obj = ORB.Object() if (sym != ORS.ident) and (sym < ORS.array): ORS.Mark("not a type_") while True: sym = ORS.Get() if (sym == ORS.ident) or (sym >= ORS.array): break if sym == ORS.ident: obj = qualident() if obj.class_ == ORB.Typ: if (obj.type_ != None) and (obj.type_.form != ORB.NoTyp): type_ = obj.type_ else: ORS.Mark("not a type_ or undefined") elif sym == ORS.array: sym = ORS.Get() type_ = ArrayType(type_) elif sym == ORS.record: sym = ORS.Get() type_ = RecordType(type_) Check(ORS.end, "no END") elif sym == ORS.pointer: sym = ORS.Get() Check(ORS.to, "no TO"); type_ = ORB.Type() type_.form = ORB.Pointer type_.size = ORG.WordSize type_.base = ORB.intType; if sym == ORS.ident: obj = ORB.thisObj() sym = ORS.Get(); if obj != None: if (obj.class_ == ORB.Typ) and (obj.type_.form in {ORB.Record, ORB.NoTyp}): type_.base = obj.type_ else: ORS.Mark("no valid base type_") ptbase = PtrBase() ptbase.name = ORS.CopyId() ptbase.type_ = type_ ptbase.next = pbsList pbsList = ptbase else: type_.base = Type(type_.base) if type_.base.form != ORB.Record: ORS.Mark("must point to record") elif sym == ORS.procedure: sym = ORS.Get() ORB.OpenScope() type_ = ORB.Type() type_.form = ORB.Proc type_.size = ORG.WordSize ProcedureType(type_, 0) type_.dsc = ORB.topScope.next ORB.CloseScope() else: ORS.Mark("illegal type_") return type_