X-Git-Url: https://dreyeck.freedombox.rocks/gitweb/idiomatic.git/blobdiff_plain/7d3a9854e6d5e13961db099f73efc29cda4d68bb..da0744c9c33ae9440765aecde2faf00f7187032f:/index.js?ds=sidebyside diff --git a/index.js b/index.js index b8d5a57..76c9158 100644 --- a/index.js +++ b/index.js @@ -37,7 +37,7 @@ app.get('/index', async (req,res,next) => { console.log(new Date().toLocaleTimeString(), 'index') const reductions = counter() const doit = branch => {reductions.count(branch.type)} - visitor.wander(mods,doit) + visitor.walk(mods,doit) const result = `
${reductions.size()} non-terminals
${reductions.total()} reductions
@@ -59,7 +59,7 @@ app.get('/terminal', (req,res) => {
const {type,field} = req.query
const lits = counter()
const doit = branch => {if(branch.type==type) lits.count(branch[field])}
- visitor.wander(mods,doit)
+ visitor.walk(mods,doit)
const result = style('terminal',type)+`
${lits.size()} uniques
${lits.total()} total
@@ -75,12 +75,11 @@ app.get('/usage', (req,res) => {
const files = counter()
const doit = (branch,stack) => {
if(branch.type==type && branch[field]==key)list.push(`
-
| ${v} | ${k}`).join("\n")} |
${files.total()} uses in ${files.size()} files
+ ${files.tally().map(([k,v]) => `
${v} ${k}`).join("\n")}
${escape(JSON.stringify(hit,omit,2))}`)
}
}
- visitor.wander(mods,doit)
- res.send(style('nesting')+`${result.join("${escape(source(stack.at(-1),branch))}${want}