(* Copyright (C) 1990, Digital Equipment Corporation *) (* All rights reserved. *) (* See the file COPYRIGHT for a full description. *) (* File: Decl.m3 *) (* Last modified on Fri Feb 23 09:47:34 1990 by muller *) MODULE Decl; IMPORT Token, Error; IMPORT Constant, Tipe, Variable, Procedure, Revelation, Exceptionz; FROM Scanner IMPORT GetToken, Fail, Match, MatchID, cur; TYPE TK = Token.T; PROCEDURE Parse (READONLY fail: Token.Set; interface, top_level: BOOLEAN) = VAR att: Attributes; BEGIN att.isInline := FALSE; att.isExternal := FALSE; att.isUnused := FALSE; att.isObsolete := FALSE; att.alias := NIL; LOOP CASE cur.token OF | TK.tEXTERNAL => GetToken (); (* EXTERNAL *) IF cur.token = TK.tIDENT OR cur.token = TK.tTEXTCONST THEN att.alias := cur.string; GetToken (); (* IDENT, TEXTCONST *) ELSE att.alias := NIL; END; att.isExternal := TRUE; | TK.tINLINE => att.isInline := TRUE; GetToken (); (* INLINE *) | TK.tUNUSED => att.isUnused := TRUE; GetToken (); (* UNUSED *) | TK.tOBSOLETE => att.isObsolete := TRUE; GetToken (); (* OBSOLETE *) ELSE EXIT; END; Match (TK.tENDPRAGMA, fail, Token.Set {}); END; CASE cur.token OF | TK.tCONST => Constant.ParseDecl (fail, att); | TK.tTYPE => Tipe.Parse (fail, att); | TK.tVAR => Variable.ParseDecl (fail, att); | TK.tPROCEDURE => Procedure.ParseDecl (fail, att, interface); | TK.tREVEAL => IF (NOT top_level) THEN Error.Msg ("nested revelation") END; Revelation.Parse (fail, att); | TK.tEXCEPTION => IF (NOT top_level) THEN Error.Msg ("nested exception declaration") END; Exceptionz.ParseDecl (fail, att); ELSE IF att.isInline OR att.isExternal OR att.isUnused OR att.isObsolete THEN Error.Msg ("declaration pragma not followed by a declaration"); END; END; END Parse; BEGIN END Decl.