\section{Finding Pascal definitions} <<*>>= global showlocal procedure main(args) showlocal := !args == "-local" go() end <<*>>= procedure postpass(name, arg) static kind initial { kind := "bogus" } case name of { "begin" : arg ? kind := tab(upto(' ')|0) "text" : if kind == "code" then arg ? if (optwhite(), =("function "|"procedure "), not hasword(arg, "forward")) then{ tab(many(' ')) writedefn(tab(upto(' ():;'))) } else if (optwhite(), x := allupper(), optwhite(), ="=") then { writedefn(x) } } return end procedure prepass(name, arg) if name == "end" then writedefn(&null) # force newline end procedure words() static alnum initial alnum := &letters ++ &digits ++ '_' suspend if any(alnum) then tab(many(alnum)) else if pos(0) then fail else if tab(upto(alnum)) then words() end procedure hasword(s, w) suspend (tab(0) ? words()) == w end procedure optwhite() suspend tab(many(' \t')) | "" end procedure allupper() static uppers initial uppers := &ucase ++ &digits ++ '_' suspend tab(many(uppers)) end procedure rcsinfo () return "$Id: pascaldefs.nw,v 1.17 2008/10/06 01:03:05 nr Exp nr $" || "$Name: v2_12 $" end