diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2020-07-06 12:53:17 -0400 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2020-07-06 12:53:17 -0400 |
| commit | 85e948b432aa26dea5b20ff9998aaef5b2ee7f69 (patch) | |
| tree | d295807fd327f7c4b4f39098f7eb81a34d82d63c | |
| parent | 69f0a05edb7bda9213ce81bbec439a24a95589db (diff) | |
Use file arguments in dzref
| -rwxr-xr-x | spec/dzref | 7 | ||||
| -rwxr-xr-x | test/dt.js | 6 |
2 files changed, 8 insertions, 5 deletions
@@ -218,6 +218,7 @@ ProgressiveIndexOf ← {𝕨⊐○(≍˘⟜OccurrenceCount𝕨⊸⊐)𝕩} ⊒ ← OccurrenceCount⊘ ProgressiveIndexOf " +X←Raw←{≤4} { chrs←⟨ "!∧∨∾↑↕⌽⍉⍋⍒⊐⊒∊⍷⊔" @@ -267,5 +268,9 @@ ProgressiveIndexOf ← {𝕨⊐○(≍˘⟜OccurrenceCount𝕨⊸⊐)𝕩} lf ← •UCS 10 pre ← E_isdef◶E_proc‿E_redef¨ lf((⊢-˜¬×+`)∘=⊔⊢)impl - ⍎ ∾ ∾⟜lf¨ pre ∾ E_proc¨ •STDIN⟨⟩ + Raw↩⍎ + ExecFile←{Raw ∾ ∾⟜lf¨ E_proc¨ •LNS 𝕩} + X↩Raw∘E_proc + ⍎ ∾ ∾⟜lf¨ pre + ≠◶X‿{ExecFile ⊑𝕩}‿{ExecFile ⊑𝕩 ⋄ X 1⊑𝕩} •args }0 @@ -1,5 +1,5 @@ //usr/bin/env node "$0" $@;exit $? -const exec = require('child_process').exec +const execFile = require('child_process').execFile , load=f=>require('fs').readFileSync(__dirname+'/'+f,'utf8') , runWasm=w=>new WebAssembly.Instance(new WebAssembly.Module(Uint8Array.from(w))) .exports.fn() @@ -8,7 +8,7 @@ const t=load('cases.bqn').split('\n').filter(x=>x).map(x=>x.split(' % ')) , test=t.map(e=>'"'+e[1]+'"').join('\n') , expt=t.map(e=>+e[0]) -var compiler = exec(__dirname+'/../spec/dzref', function (error, stdout, stderr) { +var compiler = execFile(__dirname+'/../spec/dzref',[__dirname+'/../dc.bqn','{•←Compile𝕩}¨⟨'+test+'⟩'], function (error, stdout, stderr) { const rslt=stdout.split('\n').filter(a=>a.length) .map(a=>runWasm(a.split("‿").map(n=>+n))) , pass=rslt.map((r,i)=>r===expt[i]) @@ -20,5 +20,3 @@ var compiler = exec(__dirname+'/../spec/dzref', function (error, stdout, stderr) ) process.exit(+(fail.length>0)) }); -compiler.stdin.write(load('../dc.bqn').concat('{•←Compile𝕩}¨⟨'+test+'⟩')) -compiler.stdin.end() |
