EDIFSemanticDefs1.Mesa
Spreitzer, February 20, 1986 12:24:53 pm PST
DIRECTORY EDIFDataStructure, EDIFfing, EDIFGrammar, EDIFSemantics, HashTable;
EDIFSemanticDefs1: CEDAR PROGRAM
IMPORTS EDIFGrammar, EDIFSemantics, HashTable
= {OPEN EDIFDataStructure, EDIFGrammar, EDIFSemantics;
DefineEm: PROC = {
SS[
DL[$EDIF, LIST[NameDef[], $Status, Star[$Keyword], Opt[$Rename], StarCh[LIST[$Design, $External, $Library, $Comment, $UserData]] ]],
[BeforeEDIF, AfterEDIF]];
SS[
DL[$Status, LIST[Opt[$EDIFVersion], Opt[$EDIFLevel], StarCh[LIST[$Written, $Comment, $UserData]] ]],
[BeforeStatus, AfterStatus]];
};
BeforeEDIF: Beforer = {
ew: EDIFWhole = NEW [EDIFWholePrivate ← [
status: NIL,
designs: HashTable.Create[equal: HashTable.RopeEqualModCase, hash: HashTable.HashRopeModCase],
libraries: HashTable.Create[equal: HashTable.RopeEqualModCase, hash: HashTable.HashRopeModCase],
externalLibraries: HashTable.Create[equal: HashTable.RopeEqualModCase, hash: HashTable.HashRopeModCase]
]];
context ← ew;
};
AfterEDIF: Afterer = {
ew: EDIFWhole = NARROW[context];
result ← ew;
};
BeforeStatus: Beforer = {
s: Status = NEW [StatusPrivate ← []];
WITH parentContext SELECT FROM
ew: EDIFWhole => {
IF ew.status # NIL THEN ERROR;
ew.status ← s};
ENDCASE => ERROR;
context ← s;
};
AfterStatus: Afterer = {
s: Status = NARROW[context];
IF s.level # unspecifiedLevel THEN SetLevel[s.level, 1];
result ← s;
};
}.