X-Git-Url: https://dreyeck.freedombox.rocks/gitweb/idiomatic.git/blobdiff_plain/682a7215ae646bc71baf0be528b9c7d55b1cb445..07c45e7494608140cbc197dd12753b7be1a909c6:/index.js?ds=inline
diff --git a/index.js b/index.js
index 18f87de..9f1a2b7 100644
--- a/index.js
+++ b/index.js
@@ -1,9 +1,11 @@
const express = require('express')
const acorn = require('acorn')
const fs = require('fs')
-// const fs = require('node:fs/promises');
const visitor = require('./visitor.js')
+
+// P A R S E
+
const dir = '../wiki-client/lib'
const mods = []
fs.readdir(dir, async (err, files) => {
@@ -22,77 +24,110 @@ async function load(file) {
// P A G E S
-const style = ''
+const style = (title,here='') => `
+
+
${reductions.size()} non-terminals
${reductions.total()} reductions
-
${reductions.tally()
- .map(([k,v]) => `${v} ${link(k)}`)
- .join("
")}`
- res.send(style+result);
- next()
- })
-
-function link(key) {
- if(key.match(/^Ident/)) return `${key}`
- if(key.match(/^(As|B|L|U).*Ex/)) return `${key}`
- if(key.match(/^Lit/)) return `${key}`
- return key
-}
-
+
| ${v} | ${link(k)}`) + .join("\n")} |
${lits.size()} uniques
-
${lits.total()} total
-
${lits.tally()
- .map(([k,v]) => `${v} ${escape(k)}`)
- .join("
")}`
- res.send(style+result)
+ const terms = counter()
+ visitor.walk(mods,branch => {
+ if(branch.type==type)
+ terms.count(branch[field])})
+ const result = style('terminal',type)+`
+
${terms.size()} uniques
+
${terms.total()} total
+
| ${v} | ${escape(k)}`) + .join("\n")} |
${JSON.stringify(req.query,null,2)}${list.join("${files.total()} uses in ${files.size()} files
+ ${files.tally().map(([k,v]) => `
${v} ${k}`).join("\n")}
${escape(JSON.stringify(hit,omit,2))}`)
+ ${escape(JSON.stringify(hit,omit,2))}`)
}
- }
- visitor.wander(mods,doit)
- res.send(style+`${JSON.stringify(req.query,null,2)}${result.join("${escape(source(stack.at(-1),branch))}${want}