summaryrefslogtreecommitdiff
path: root/web/noweb/contrib/kostas/mathdefs.nw
diff options
context:
space:
mode:
Diffstat (limited to 'web/noweb/contrib/kostas/mathdefs.nw')
-rw-r--r--web/noweb/contrib/kostas/mathdefs.nw24
1 files changed, 24 insertions, 0 deletions
diff --git a/web/noweb/contrib/kostas/mathdefs.nw b/web/noweb/contrib/kostas/mathdefs.nw
new file mode 100644
index 0000000000..e77f7d3845
--- /dev/null
+++ b/web/noweb/contrib/kostas/mathdefs.nw
@@ -0,0 +1,24 @@
+\section{Finding \textsl{Mathematica} definitions}
+
+This will simply recognize definitions made with ``:=''.
+<<*>>=
+procedure main(args)
+ go()
+end
+<<*>>=
+procedure postpass(name, arg)
+ static kind, id
+ initial {kind := "bogus"; id := &letters ++ &digits}
+ case name of {
+ "begin" : arg ? kind := tab(upto(' ')|0)
+ "text" : if kind == "code" then
+ arg ? if s := tab(find(":=")) then
+ {s ? {tab(many(' ')); writedefn(tab(many(id)))}
+ }
+ }
+ return
+end
+
+procedure prepass(name, arg)
+ if name == "end" then writedefn(&null) # force newline
+end