-- JunoLookupImpl.mesa -- August 31, 1983 4:03 pm -- Last Edited by: Gnelson, December 10, 1983 5:35 pm DIRECTORY JunoSyntax, JunoLookup, ParseWindow; JunoLookupImpl: PROGRAM IMPORTS JunoSyntax EXPORTS JunoLookup = {OPEN JS: JunoSyntax; GetFunDef: PUBLIC PROC [name: JS.FunName, defs: REF] RETURNS [JS.FunDef] = {l: LIST OF ParseWindow.NodeContent _ NARROW[defs, ParseWindow.Handle].content; WHILE l # NIL AND (l.first.tree = NIL OR NOT(IsFunDefOf[name, l.first.tree])) DO l _ l.rest ENDLOOP; IF l = NIL THEN RETURN [NIL] ELSE RETURN [l.first.tree]}; GetPredDef: PUBLIC PROC [name: JS.PredName, defs: REF] RETURNS [JS.PredDef] = {l: LIST OF ParseWindow.NodeContent _ NARROW[defs, ParseWindow.Handle].content; WHILE l # NIL AND (l.first.tree = NIL OR NOT(IsPredDefOf[name, l.first.tree])) DO l _ l.rest ENDLOOP; IF l = NIL THEN RETURN [NIL] ELSE RETURN [l.first.tree]}; GetProcDef: PUBLIC PROC[name: JS.ProcName, defs: REF] RETURNS [JS.ProcDef] = {l: LIST OF ParseWindow.NodeContent _ NARROW[defs, ParseWindow.Handle].content; WHILE l # NIL AND (l.first.tree = NIL OR NOT(IsProcDefOf[name, l.first.tree])) DO l _ l.rest ENDLOOP; IF l = NIL THEN RETURN [NIL] ELSE RETURN [l.first.tree]}; IsFunDefOf: PROC[name: JS.FunName, tree: REF] RETURNS [BOOLEAN] = {RETURN [JS.IsFunDef[tree] AND name = JS.FunOfFunDef[tree]]}; IsPredDefOf: PROC[name: JS.FunName, tree: REF] RETURNS [BOOLEAN] = {RETURN [JS.IsPredDef[tree] AND name = JS.PredOfPredDef[tree]]}; IsProcDefOf: PROC[name: JS.FunName, tree: REF] RETURNS [BOOLEAN] = {RETURN [JS.IsProcDef[tree] AND name = JS.ProcOfProcDef[tree]]}; }.